允许.htaccess RewriteCond重定向异常

时间:2013-09-19 01:10:38

标签: apache .htaccess http redirect mod-rewrite

这是我当前.htaccess文件的表示,我用它来代理内部服务:

RewriteEngine On
RewriteRule (.*)admin(.*) https://some/path/forbidden.html [L,R=301]
RewriteRule uri1/(.*)$ http://localhost:30000/$1 [P]
RewriteRule uri2/(.*)$ http://localhost:30001/$1 [P]

它的效果很好,但是我想在“admin / reset”中允许一个例外,但在包含“admin”的任何其他uri上继续执行301。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

您可以使用条件:

RewriteCond %{REQUEST_URI} !admin/reset
RewriteRule (.*)admin(.*) https://some/path/forbidden.html [L,R=301]