Created
November 8, 2012 21:46
-
-
Save michaelfox/4041894 to your computer and use it in GitHub Desktop.
Force 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
<IfModule mod_rewrite.c> | |
# Force www | |
RewriteEngine on | |
RewriteCond %{HTTPS} (on)? | |
RewriteCond %{HTTP_HOST} !^www\..+$ [NC] | |
RewriteRule ^ http(?%1s)://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
</IfModule> | |
RewriteEngine on | |
RewriteCond %{HTTPS} (on)? | |
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC] | |
RewriteCond %{REQUEST_URI} (.+) | |
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment