Created
December 12, 2016 14:01
-
-
Save therealkevinard/fcec561e51adcedac7b3dab8067a53a0 to your computer and use it in GitHub Desktop.
Force www or no-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
# only use one of these. | |
#Force www: | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^site.com [NC] | |
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301,NC] | |
#Force non-www: | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www\.site\.com [NC] | |
RewriteRule ^(.*)$ http://site.com/$1 [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment