Last active
June 1, 2016 09:26
-
-
Save fernandiez/46a910407355cc16be8f2c4a65181dc5 to your computer and use it in GitHub Desktop.
Redirection 301 .htaccess from HTTP to HTTPS (with www)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Redirect 301 from HTTP to HTTPS | |
#First, rewrite any request to the correct domain (with www) | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
#Then, rewrite to HTTPS: | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment