Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule in root .htaccess not working

Apparently due to subdirectory .htaccess file

         

cschults

10:09 pm on Jul 15, 2009 (gmt 0)

10+ Year Member



In my root .htaccess file, I have the following RewriteRule that is not working:

RewriteRule ^dir1/dir2/dir3/(.*)$ /dir1/dir2/index.html [R,L]

I believe it is due to another .htaccess file in /dir1/dir2/ because as soon as I remove it, my first rule works.

Now, I can simply move the single rule in /dir1/dir2/ to my root .htaccess, but I don't understand why there is a conflict.

jdMorgan

11:00 pm on Jul 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That would rather depend on *what* the rule in the subdirectory is, what it's intended to do, and whether you have (and/or want) RewriteOptions inherit enabled.

Jim

cschults

11:37 pm on Jul 15, 2009 (gmt 0)

10+ Year Member



RewriteOptions inherit does NOT appear to be enabled. And I don't think the single RewriteRule should not be the culprit:

RewriteRule ^pdf/?$ /pdf/some_file.pdf

jdMorgan

12:04 am on Jul 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What URLs are you testing with? A request for /dir1/dir2/pdf/ will certainly cause the /dir1/dir2/.htaccess file to override the /.htaccess file's rule, but that's the only 'collision' I see. What are your DirectoryIndex settings? Do you have MultiViews or AcceptPathInfo enabled?

Jim

cschults

4:48 pm on Jul 17, 2009 (gmt 0)

10+ Year Member



DirectoryIndex index.cgi index.html index.html.var

And I don't believe MultiViews or AcceptPathInfo are enabled.

The two URLs in question are such that there should not be any collision. Since moving one of the rules, all is well, so I'm going to let this be for now.

Thanks for you help, again!

Chris