重写规则的问题

发布于 2024-11-10 14:43:58 字数 486 浏览 0 评论 0原文

有问题不要一开始就停止而是继续到第三条规则,问题就在这里。有几条线路规则,并以管理不适合任何内容的规则结尾。

当我禁用第三条规则时,/新闻将不起作用,但现在,规则 1 起作用。

第二条规则没有任何问题。

我已经检查过 news2.php?readmore=$1 之后的查询是否有循环,然后在 news2.php 上询问 news_cats.php,情况并非如此。

我还一直在查看 htaccess 文件中是否存在循环,但事实并非如此。

什么是问题?

RewriteRule ^news/([0-9]+)/[^/]*/?$ news2.php?readmore=$1 [L]
RewriteRule ^news_category/([0-9]+)/[^/]*/?$ news_cats.php?cat_id=$1 [L]
RewriteRule ^news news_cats.php [L]

There is problem with it do not stop at first but continues to the third rules, the problem is just here.; There is several line rules and ending with rules that manage that does not fit on anything.

When I disable 3rd rules will /news not work but now, rules 1 works.

There are not any problems with the second rules.

I have gone through whether there is a loop through the query after news2.php?readmore=$1 and then on news2.php ask for news_cats.php, that is not the case.

I've also been looking at whether there is a loop in the htaccess file that is not the case.

What is problem?

RewriteRule ^news/([0-9]+)/[^/]*/?$ news2.php?readmore=$1 [L]
RewriteRule ^news_category/([0-9]+)/[^/]*/?$ news_cats.php?cat_id=$1 [L]
RewriteRule ^news news_cats.php [L]

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

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

发布评论

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

评论(1

花之痕靓丽 2024-11-17 14:43:58

哦,我发现了错误。这是 htaccess 中的一个循环。

3条规则新闻不仅适合新闻,而且还可以捕获文件“news”2.php

解决方案。

RewriteRule ^news(?!2\.php) news_cats.php [L]

Ooooh I've found the error. It is a loop in the htaccess.

3 rules news will fit not only news, but it would also capture the file "news"2.php

The solution.

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