Home htaccess redirect best way to do it?
Reply: 0

htaccess redirect best way to do it?

user483 Published in July 17, 2018, 3:22 pm

redirecting to https and non-www to www. I'm using the following. For the last line is it best to use ^ or .* or maybe ^(.*)$ directly after RewriteRule? I see all them used and all work. Just don't know enough which is best. Thank you!

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.370577 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO