Last active
October 23, 2019 11:09
-
-
Save eksiscloud/4f3d47fdcbd9ed6215de2be890b28639 to your computer and use it in GitHub Desktop.
Redirect a site to new domain
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
# Rewriting on | |
RewriteEngine on | |
# redirect to same page in the new site as where a user was in the old site | |
RewriteBase / | |
RewriteCond %{SERVER_NAME} =old-domain.com [OR] | |
RewriteCond %{SERVER_NAME} =new-domain.com | |
RewriteRule ^ http://new.domain.com%{REQUEST_URI} [END,NE,R=301] | |
# you can use IfModule structure too. | |
# You can put it in vhost conf or in .htaccess | |
#<IfModule mod_rewrite.c> | |
#RewriteCond %{SERVER_NAME} =old-domain.com [OR] | |
#RewriteCond %{SERVER_NAME} =new-domain.com | |
#RewriteRule ^ http://new.domain.com%{REQUEST_URI} [END,NE,R=301] | |
#</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment