Forum Moderators: phranque
What's the advantage of either method?
RewriteRule (*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
what problem are you trying to solve?No problem, just getting ready to flip the switch from http to https. My host's set-up will allow both versions (after I turn on the cert) so want to force all requests to https.
#Redirect invalid and non www requests
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) https://www.example.com/$1 [R=301,L] and a second one to convert third party resources to https (after determining whether they exist that way) to avoid the mild warning for mixed security. Not an ecommerce site and no logins needed. RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
what problem are you trying to solve?
No problem, just getting ready to flip the switch....
Just one domain using www so you would suggest this?
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- or -
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^ https://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]
Also would existing in-site links (page to page) absolute links need to be changed to https or does the rewrite rule effectively do this?