Mod_rewrite,如何停止应用于一个查询字符串的规则?
我有一个重写规则列表,但其中一个规则适用于我需要它不适用的事物。
这是导致问题的重写规则,
RewriteRule ^([^/]*)/$ /category.php?category=$1 [L]
它的意思是将 .com/catname/ 重写为 /category.php?category=catname它确实很好,但我需要它不适用于以 /feed/ 开头的任何内容,因为这些内容不是由category.php 处理的。 我对提要有这条规则,但它没有机会做它的事情...
RewriteRule ^feed/([^/]*)/$ /feed/?cat=$1 [L]
任何人都可以帮忙吗?
谢谢。
I have a list of rewrite rules, but one of the rules is applying to something I need it to not apply to.
Here is the rewrite rule causing the problem,
RewriteRule ^([^/]*)/$ /category.php?category=$1 [L]
It's meant to rewrite .com/catname/ to /category.php?category=catname which it does fine, but I need it to not apply to anything beginning with /feed/, as these aren't handled by category.php.
I have this rule for the feeds, but it's not getting a chance to do it's thing...
RewriteRule ^feed/([^/]*)/$ /feed/?cat=$1 [L]
Can anyone help?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的规则的顺序是什么?您应该将
/feed/
规则作为第一个规则。What is the sequence of your rules? You should put the
/feed/
rule as first one.将 Feed 规则放在其他规则之前。
Put the rule for the feeds before the other rule.