Created
July 11, 2018 19:00
-
-
Save javascriptlove/90229e9a8e3a6cd46258b109fb148e80 to your computer and use it in GitHub Desktop.
Redirect from/to 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
# www to non-www | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] | |
# non-www to www: | |
RewriteCond %{HTTP_HOST} ^example.com [NC] | |
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment