Does mod_rewrite in subdirectories' .htaccess override higher levels?
- by Ryan
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?