Created
January 4, 2019 15:01
-
-
Save loughlincodes/4f93e2f591dbf8dc8b8c0a487dd02b10 to your computer and use it in GitHub Desktop.
htaccess - www and non-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
#Force www: | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^example.com [NC] | |
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC] | |
#Force non-www: | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] | |
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment