badstraw360
Member
Hey guys I recently implemented ssl on my site and I'm trying these rewrite rules:
I've read that this rule is the preferred one by this community:
But this one seems to work:
If I use the first one I can access the site with www and without www, which seems to create duplicate content. (I DON'T KNOW WHY IT'S RECOMMENDED BY THE WAY)
Apparently,the second one works to force www and SSL, but I'm not sure..
Should I use a different redirection rule like this one:
Which redirection rule is better?
I've read that this rule is the preferred one by this community:
Code:
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
But this one seems to work:
Code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.site.com/$1 [L,R=301]
If I use the first one I can access the site with www and without www, which seems to create duplicate content. (I DON'T KNOW WHY IT'S RECOMMENDED BY THE WAY)
Apparently,the second one works to force www and SSL, but I'm not sure..
Should I use a different redirection rule like this one:
Code:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.site.net/$1 [R,L]
Which redirection rule is better?
Last edited: