Last active
October 22, 2018 18:41
-
-
Save rotten77/7672cd9d773ba1f1fd42 to your computer and use it in GitHub Desktop.
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
# basic | |
RewriteEngine on | |
RewriteBase / | |
ErrorDocument 404 /404.html | |
# https | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# always "www" variant | |
RewriteCond %{HTTP_HOST} ^domain\.com | |
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] | |
# always "no-www" variant | |
RewriteCond %{HTTP_HOST} ^www\.domain\.com | |
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301] | |
# redirect to other domain (with required url) | |
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L,QSA] | |
# redirect to other domain (all to root) | |
RewriteRule ^(.*)$ http://www.new-domain.com/ [R=301,L,QSA] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment