How to set cannonical https://www in .htaccess
-
Hello,
I understand that for SEO reasons it is better to force browsers/web crawlers to use either the www or “non”www version of your domain. Apparently it doesn’t seem to matter which but you need to choose one and enforce it.
Currently I have this in my .htaccess file to force the SSL version of my domain URL.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] </IfModule>
It works well enough for that purpose.
However it doesn’t force the www version of my URL which is what i want.If I simply do this:
RewriteRule ^(.*)$ https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
I guess that would work for urls that point to https://mydomain.com
but it wouldn’t catch https://mydomain.comAny help appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to set cannonical https://www in .htaccess’ is closed to new replies.