Created
April 28, 2015 20:34
-
-
Save underwhelmed/f97325139c8a11024085 to your computer and use it in GitHub Desktop.
Redirect all http and https traffic from naked domain to 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 HTTP without www to HTTP with www | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Redirect HTTPS without www to HTTPS with www | |
RewriteCond %{HTTPS} on | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment