Created
February 16, 2013 22:15
-
-
Save Kaapiii/4968970 to your computer and use it in GitHub Desktop.
Redirecting non-www to www and vice versa
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
# Redirecting non-www to www | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
# Redirecting www to non-www | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC] | |
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment