Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com [NC]
RewriteRule (.*) [domain1.com...] [R=301,L]
It worked fine before. Could anybody please tell me why those lines don't work when standing alone? I can't understand how the removal of the previous lines interfer.
It's a case with more than one domain on the same IP. I try to get domain1 to always redirect to domain1/folder1/. The other domains do not redirect in this way and are OK.
The previous lines were, in case someone is interested:
RewriteRule ^folder2¦foolder3 - [L]
RewriteCond %{HTTP_HOST} !^(www\.)?domain2\.com [NC]
RewriteRule ^folder1 - [L]
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com [NC]
RewriteRule (.*) [domain3.com...] [R=301,L]
Folder1, 2 and 3 are all under domain1.
RewriteCond %{HTTP_HOST} !^(www\.)?domain2\.com [NC]
RewriteRule ^folder1 - [L]
RewriteCond %{REQUEST_URI} !^/folder1
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com [NC]
RewriteRule (.*) http://www.domain1.com/folder1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/folder1
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com [NC]
RewriteRule (.*) /folder1/$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?domainY\.com [NC]
RewriteRule ^folder1 [domainX.com...] [R=301,L]
In the previous rule (not shown here) all requests for a domainZ are first redirected to domainY. (Z actually represents more than one now parked domain.)
But, if the request as an exception was for domainZ/folder1/, then it is to be served as domainX/folder1/. (Folder1 is intended to exist only under domainX, but there is some SE mess.) It's a double redirection and only occasionally needed.