使用PCRE的RedirectMatch规则异常

时间:2014-03-31 13:56:14

标签: regex apache redirect http-redirect

我有一个工作的RedirectRule,我想添加一个异常。这是当前的RedirectRule:

RedirectMatch (?i)/.+menu\.html$ http://www.foobar.com/foobar.html

我想从这条规则中免除ext3270-Menu.html。

我在https://serverfault.com/questions/189666/make-exception-to-whole-site-redirectmatch-rule找到了以下示例:

RedirectMatch permanent ^/?((?!(thisisfoo|thisisbar)).*) https://www.foobar.com/$1

我希望在PCRE上比我更娴熟的人可以用类似的东西来回应我的要求。

由于

1 个答案:

答案 0 :(得分:0)

正如您所说PCRE,请使用否定前瞻来查看您的URI中是否没有ext3270-Menu.html

(?i)^/(?!.*ext3270-Menu\.html).+menu\.html$

Online Demo