Mod_rewrite,如何停止应用于一个查询字符串的规则?

发布于 2024-08-24 19:48:21 字数 355 浏览 4 评论 0原文

我有一个重写规则列表,但其中一个规则适用于我需要它不适用的事物。

这是导致问题的重写规则,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

榕城若虚 2024-08-31 19:48:21

你的规则的顺序是什么?您应该将 /feed/ 规则作为第一个规则。

What is the sequence of your rules? You should put the /feed/ rule as first one.

无人接听 2024-08-31 19:48:21

将 Feed 规则放在其他规则之前。

Put the rule for the feeds before the other rule.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文