I am having trouble with a redirect in my top level domain if a subdirectory also contains a .htaccess file.
To help explain, here is my directory structure.
www.domain1.com points to directory /public_html
www.domain2.com points to directory /public_html/domain2
My goal is to keep people from directly accessing directory domain2 using
http://www.domain1.com/domain2/
I want them to access it only by
http://www.domain2.com/
Here is the .htaccess file that I have placed in directory /public_html
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com$
RewriteRule ^domain2\/?(.*)$ - [F]
If I do not have a .htaccess file in directory /public_html/domain2, then this works fine and properly displays the Forbidden error.
In directory /public_html/domain2 I also have the following .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule ^forums\/?(.*)$ "http\:\/\/forums\.domain2\.com\/$1" [R=301,L]
because I want users to be sent to
http://forums.domain2.com
when they enter
http://www.domain2.com/forums/
(this redirection works fine)
The problem I am encountering is when directory /public_html/domain2 contains a .htaccess file, then the rewrite rule in the .htaccess file in directory /public_html for domain www.domain1.com does not work.
Any assistance will be apperciated.
Steve