Created
May 10, 2012 07:40
-
-
Save kathangeorg/2651727 to your computer and use it in GitHub Desktop.
.htaccess reditect non www to www
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
#non www to www | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
#www to non www | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC] | |
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L] | |
#http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment