Reputation: 419
I would like to redirect people visiting x.com/sub to y.com/sub/
This .htaccess in the sub-Folder gives me an ERR_TOO_MANY_REDIRECTS
RewriteEngine On
RewriteRule ^(.*)$ https://www.y.com/sub/$1 [R=301,L]
Does anyone know, how the correct rule should look like and where I need to put it? Thanks!
Upvotes: 1
Views: 38
Reputation: 785531
Add a RewriteCond
to check for original host:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?(?:x|v|w)\.com$ [NC]
RewriteRule ^ https://www.y.com%{REQUEST_URI} [R=301,NE,L]
Test it from a new browser to avoid old cache.
Upvotes: 1