views:

90

answers:

1

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?

+1  A: 

Check the inherit flag of the RewriteOptions directive here.

Simon Linder
Thanks, Simon. Adding `RewriteOptions Inherit` to the subdirectory's .htaccess file fixed the problem.
Ryan