scpbl Posted October 8, 2014 Posted October 8, 2014 how do I permanatly redirect both example.com and www.example.com to https://www.example.com
Tjoene Posted October 14, 2014 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]
scpbl Posted October 14, 2014 Author 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?
Tjoene Posted October 14, 2014 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>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now