开发者

Does mod_rewrite in subdirectories' .htaccess override higher levels?

开发者 https://www.devze.com 2022-12-23 03:41 出处:网络
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:

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 t开发者_Go百科he top-levle file both rules work. Can someone explain what is happening here?


Check the inherit flag of the RewriteOptions directive here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号