-
-
Save 6ui11em/2578698 to your computer and use it in GitHub Desktop.
htaccess: Redirection rules
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
RewriteEngine On | |
RewriteBase / | |
### 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] | |
### Redirect old non-www to new non-www ### | |
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] | |
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301] | |
### Redirect old www to new www ### | |
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] | |
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301] | |
### Simple page redirect ### | |
RewriteCond %{QUERY_STRING} ^$ | |
RewriteRule ^page_one\.html$ /page_tow.html? [R=301,NE,NC,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment