Hi, I am a non-www advocator, but am not a professional tech/coder. I was wondering if anyone can tell me how to make the above two rewrites, the most direct and official way.
My search has given me the following:
RewriteCond %{HTTPS} !on
RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
And this is force-https rewrite. I can go into the panel – configurations – rewrite rules, and put the codes inside and save them.
But for the www to non-www part, well, I tried a couple of times but seemed it’s not working.
My codes are like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
Is this config right?