Created
March 28, 2012 03:00
-
-
Save crazy4groovy/2223191 to your computer and use it in GitHub Desktop.
Rules for htaccess redirect
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
I would recommend inserting this code just after the line reading "RewriteEngine On": | |
[Redirect www to non-www] | |
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] | |
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301] | |
[Redirect non-www to www] | |
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC] | |
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment