Try to redirect full domain but home to a specific url

Viewed 64

I'm trying to redirect a domain to a new domain with same urls, but i need that the home (or '/') goes to an specific url.

i use that for redirect all with same structure

<IfModule https://mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^https://webantigua.com$ [OR]
 RewriteCond %{HTTP_HOST} ^https://www.webantigua.com$
 RewriteRule (.*)$ https://webnueva.com/$1 [R=301,L]
</IfModule>

But i need a rule for home to go to https://webnueva.com/web-antigua/

What can i do?

1 Answers

Could you please try following Rules, written as per your shown attempts. Please make sure you clear your browser cache before testing your URLs.

<IfModule https://mod_rewrite.c>
 RewriteEngine ON
 ####OP's attempted rules here, with small fixes in them.
 RewriteCond HTTPS ON
 RewriteCond %{HTTP_HOST} ^(www\.)?webantigua\.com$ [NC]
 RewriteCond %{REQUEST_URI} !^/?$
 RewriteRule ^ https://webnueva.com%{REQUEST_URI} [NE,R=301,L]

 RewriteCond HTTPS ON
 RewriteCond %{HTTP_HOST} ^(www\.)?webantigua\.com$ [NC]
 RewriteRule ^/?$ https://webnueva.com/web-antigua/ [R=301,L]
</IfModule>
Related