每个 URl 的正则表达式合规性,但包含的特定字符串除外



如果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似乎并不准确。

最终正则表达式是:

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

感谢您的帮助和网站

相关内容

最新更新