Does mod_rewrite in subdirectories' .htaccess override higher levels?

Posted by Ryan on Stack Overflow See other posts from Stack Overflow or by Ryan
Published on 2010-03-15T17:08:14Z Indexed on 2010/03/15 17:09 UTC
Read the original article Hit count: 304

Filed under:
|
|

I'm using mod_rewrite to map my old directory structure to a new one. I have the following rule in my top-level .htaccess file, and it works:

RewriteEngine On
RewriteCond %{REQUEST_URI} /blog/archives/(.*)
RewriteRule ^.*$ /archives/%1 [L,R=301]

As you can guess, this takes http://example.com/blog/archives/00001.php and redirects it to http://example.com/archives/00001.php.

But when I add these rewrite rules to the .htaccess file in the /blog directory

RewriteEngine on
RewriteRule atom.xml$ /atom.xml [L,R=301]

the top-level redirect no longer works. If I move the rule in the /blog .htaccess file to the top-levle file both rules work. Can someone explain what is happening here?

© Stack Overflow or respective owner

Related posts about mod-rewrite

Related posts about apache