htaccess:将两个相似的 RewriteCond 放在一个中,然后取“所有其他的,而不是那个”

发布于 2025-01-05 01:31:16 字数 293 浏览 1 评论 0原文

我需要将这两行合并为一行,并将 NOT 放在该行之前。

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/([^/]+)\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/\ HTTP/ [NC]

因此,它将是“获取所有不经过这两个 RewriteCond 的所有内容,并排除所有经过这两个 RewriteCond 的内容”。

谢谢。

I need to unite these two lines into one and put NOT before that one.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/([^/]+)\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/\ HTTP/ [NC]

So, it will be "take everything, that doesn't go through that two RewriteCond, and exclude everything that does".

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

第几種人 2025-01-12 01:31:16

下面的解决方案将这两个规则合二为一。

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/(\ |[^/\ ]+\ )  [NC]

如果你想匹配任何与上面不匹配的内容,那么将其否定

RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ /administration/(\ |[^/\ ]+\ )  [NC]

The solution below combines both rules into one.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /administration/(\ |[^/\ ]+\ )  [NC]

If you want to match anything that does not match the above then negate it

RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ /administration/(\ |[^/\ ]+\ )  [NC]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文