mod_rewrite:[OR]和隐式[AND]的优先级
是否可以使用 mod_rewrite?
我有以下规则向我网站的访客提供 dummy.png,他们没有设置 2 个 cookie id 和 auth (我在自定义 Drupal 模块中设置了这些)对于注册用户):
RewriteCond %{REQUEST_URI} ^/sites/default/files/pictures/picture-
RewriteCond %{HTTP_COOKIE} !auth [OR]
RewriteCond %{HTTP_COOKIE} !id
RewriteRule .+ /images/dummy.png [L]
但我不确定它是否按预期工作(也许它充当(X和Y)或Z?)
Is it possible to check for X and (Y or Z) with mod_rewrite?
I have the following rule to serve dummy.png to guests of my website, who don't have 2 cookies id and auth set (I set those in my custom Drupal module for registered users):
RewriteCond %{REQUEST_URI} ^/sites/default/files/pictures/picture-
RewriteCond %{HTTP_COOKIE} !auth [OR]
RewriteCond %{HTTP_COOKIE} !id
RewriteRule .+ /images/dummy.png [L]
but I'm not sure if it works as intended (maybe it acts as (X and Y) or Z instead?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以让 RewriteRule 处理 URI 模式匹配。无需在 RewriteCond 中执行此操作。对于其他 URL,前两个条件可能匹配,但规则本身不会匹配,并且不会发生重写。
You can let the RewriteRule handle the URI pattern matching. No need to do that in a RewriteCond. For other URLs, the first two conditions may match, but the rule itself won't and no rewrite will take place.