Last active
August 29, 2015 14:01
-
-
Save oreales/3b31c6a872de47a7d9b9 to your computer and use it in GitHub Desktop.
.htaccess rewrite a www y https
This file contains hidden or 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
############################################ | |
## rewrites to https y www | |
#First rewrite any request to the wrong domain to use the correct one (here www.) | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
#Now, 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