0

There's actually 2 questions.

One is, how do I make RewriteCond+RewriteRule change domain2/folder1 to domain1/folder1

Actually what I want is any domain that tries to access folder1 that is not domain1 gets switched to domain1. So for example domain2.com/domain1/foo -> domain1.com/domain1/foo as well as domain3.com/domain1/foo -> domain1.com/domain1/foo

This is what I tried

RewriteCond %{HTTP_HOST}     !^domain1\.com$ [NC]
RewriteCond %{REQUEST_URI}   ^/folder1/
RewriteRule ^/folder1/(.*)$  http://domain1.com/folder1/$1 [L,R=permanent]

But that doesn't work. Next I tried some a simpler rule to see if I could narrow down the issue.

RewriteCond ${HTTP_HOST}  domain2\.com [NC]
RewriteRule ^(.*)$        http://google.com/ [L]

I though that would make ANY request to domain2.com go to google.com so I tried http://domain2.com/foo but I get domain2.com/foo not google.com If I go to http://domain2.com I get google. Why don't I get there if I go to http://domain2.com/foo?

What am I not understanding about mod_rewrite?

1 Answers1

0

Never mind. The above rules work. The issue was I actually had a "folder1" and inside was another .htaccess file. DOH!