Last active
July 22, 2020 15:05
-
-
Save bavington/5982551 to your computer and use it in GitHub Desktop.
.htaccess rewrite code to use when 301'ing to a new domain name whilst maintaining the same URL paths.
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 | |
RewriteCond %{HTTP_HOST} !^www\.newdomain\.co.uk | |
RewriteRule (.*) http://www.newdomain.co.uk/$1 [R=301,L] |
Hello @gabrieizalo for redirect with HTTPS use:
RewriteEngine on
RewriteCond %{HTTPS_HOST} !^www.newdomain.com
RewriteRule (.*) https://newdomain.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTPS_HOST} !^www.newdomain.com
RewriteRule (.*) https://newdomain.com/$1 [R=301,L]
perfectly working ...
if I want to only one folder www.olddomain.com/backoffice and its sub folders NOT to redirect and stay there
how to do it ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
It don't redirects if the Old Domain is with HTTPS.
:(