scpbl Posted October 8, 2014 Share Posted October 8, 2014 how do I permanatly redirect both example.com and www.example.com to https://www.example.com Quote Link to comment Share on other sites More sharing options...
Tjoene Posted October 14, 2014 Share Posted October 14, 2014 If you want to redirect http to https, you can use the following code in your .htaccess file RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Quote Link to comment Share on other sites More sharing options...
scpbl Posted October 14, 2014 Author Share Posted October 14, 2014 That will redirect http://example.com to https://example.com and http://www.example.com to https://www.example.com. However, I want to redirect both http://example.com and http://www.example.com to https://www.example.com. Anyone know how to do this? Quote Link to comment Share on other sites More sharing options...
Tjoene Posted October 14, 2014 Share Posted October 14, 2014 If you also want to redirect example.com to www.example.com, use this code: <IfModule mod_rewrite.c> RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} !^www\..+$ [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </IfModule> Quote Link to comment Share on other sites More sharing options...
scpbl Posted October 19, 2014 Author Share Posted October 19, 2014 That doesn't rewrite to https though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.