除包括特定字符串之外的所有URl的RegEx合规性

时间:2019-06-04 07:12:28

标签: regex apache url-rewriting

如果URL货币与国家/地区不匹配,我想通过URL重写自定义URL。

我当前在Apache上的重写规则如下:

RedirectMatch permanent "^/(.*)_DE/(?!.*(EUR))(.*)$" "https://localhost/$1_DE/EUR$2"

因此必须将URL https://localhost/de_DE/USD更改为https://localhost/de_DE/EUR,但不幸的是该规则不适用。

是否有用于Apache RegEx的Web测试器? regex101.com似乎不适用于Apache。

1 个答案:

答案 0 :(得分:0)

最终RegEx是:

RedirectMatch permanent "^/(.*)_DE/((?!.*EUR)[A-Z{3,3}]+)(.*)$" "https://localhost/$1_DE/EUR$3"

感谢您对网站的帮助