Reputation: 472
I want to redirect the home page to another page in the new domain
www.domain.com www.newdomain.com/landing
www.domain.com/es www.newdomain.com/es/landing
www.domain.com/en www.newdomain.com/en/landing
The others page differente of the home, I can redirect with the rule "Redirect 301", but, When I want the redirect the home page It's turn crazy
example
Redirect 301 / /www.newdomain.com/landing
Redirect 301 /es /www.newdomain.com/es/landing
Redirect 301 /en /www.newdomain.com/en/landing
In the home multilanguage, redirect to www.newdomain.com/landinges
Exist another way? I try with Rewrite Rule, but doesn't work or I add incorrectly the code.
Upvotes: 1
Views: 56
Reputation: 784868
Redirect 301 /
will redirect all the pages on your website to the target URL and rest of the rules below this will not be used.
You can use RedirectMatch
with regex match exactly what you want:
RedirectMatch 301 ^/$ /www.newdomain.com/landing
RedirectMatch 301 ^/es/?$ /www.newdomain.com/es/landing
RedirectMatch 301 ^/en/?$ /www.newdomain.com/en/landing
Alternatively you can change the order of your rules:
Redirect 301 /es /www.newdomain.com/es/landing
Redirect 301 /en /www.newdomain.com/en/landing
Redirect 301 / /www.newdomain.com/landing
And don't forget to clear your browser cache.
Upvotes: 1