【发布时间】:2017-08-26 05:52:26
【问题描述】:
我正在尝试匹配所有以 #/tool_[a-z\-]+# 开头的 URI,除了,如果它后跟 /public。比如/tool_calculator或者其他什么的。
例如,如果 URI 以 /tool_store-front 或 /tool_store-front/anything-but-public 开头,那么我想将它们重定向到 HTTPS。所以,/tool_store-front/public 不会 重定向。
这是我拥有的,但它不起作用
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} ^/?tool_[a-z-]+(?!/public.+) [OR]
RewriteCond %{REQUEST_URI} ^/?secure
RewriteCond %{REQUEST_URI} !^/?secure/public/info
RewriteRule ^(.*)$ https://www.example.org%{REQUEST_URI} [NC,L]
【问题讨论】:
标签: regex .htaccess mod-rewrite regex-greedy negative-lookahead