I have the .htaccess file configured so that several domains pull it, in a multisite wordpress, which resolves different domains, so far so good.
The problem comes when I want to do the 301 redirection, only for the page of a language:
That is, I have: http://domain.es/home and http://domain.com/home what I need is to redirect the home page, within domain.com but not the home page, in domain.es
In summary:
http://domain.es/home -> http://domain.es/home
http://domain.com/home -> http://domain.com/home
I can't use a 301, because it drags me both home pages. I have tried
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?dominio.com/inicio [NC]
RewriteRule ^inicio/$ home/ [R=301,L]
But it doesn't work and I can't solve it. Thanks for your help
I add the real data of the domain that I am using in case you see something that has happened to me
http://teinnovacleaning.es/rtest -> http://teinnovacleaning.es/rtest
http://teinnovacleaning.com/rtest -> http://teinnovacleaning.com/home
And my .htaccess is like this
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?teinnovacleaning\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/rtest$ [NC]
RewriteRule ^rtest$ home/ [R=301,NC,L]
The logic is fine in what you tried, just need to tweak a bit what it matches and where it redirects to.
%{HTTP_HOST}
is the host, without the path.In the RewriteRule , it
^inicio/$
has a trailing slash that causes it to not match, and we can make it optional.