.htaccess规则问题

发布于 2025-01-08 04:36:16 字数 413 浏览 3 评论 0原文

我目前正在使用 .htaccess 为我的页面编写规则。

我有一个论坛,其原始 URL 是:?i=f

然后将其重写为:

RewriteRule ^forum /?i=f [L]  

This Works。虽然我的问题来了。当我希望深入到页面、论坛的类别时,实际的 URL 是: ?i=f&p=t&cid=ID

我尝试做的是这条规则:

RewriteRule ^forum/cat/([^/]*)$ /?i=f&p=t&cid=$1 [L]

尽管这不起作用,因为 /forum 已经定义了。我该怎么做?

谢谢。

I am currently writing rules for my pages, with .htaccess.

I have a forum, the original URL of this is: ?i=f

This will then be rewritten to:

RewriteRule ^forum /?i=f [L]  

This works. Although here comes my problem. When I wish to go deeper into the pages, to the categories of the forum, the actual URL is: ?i=f&p=t&cid=ID

What I try to do is this rule:

RewriteRule ^forum/cat/([^/]*)$ /?i=f&p=t&cid=$1 [L]

Although that does not work, since the /forum is already defined. How can I do this?

Thanks.

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

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

发布评论

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

评论(1

橘和柠 2025-01-15 04:36:16

删除 RewriteRule ^forum /?i=f [L]
并添加以下规则:

RewriteRule ^forum(?:/cat/([^/]*))?$ /?i=f&p=t&cid=$1 [L]

Remove RewriteRule ^forum /?i=f [L]
and add Just this rule:

RewriteRule ^forum(?:/cat/([^/]*))?$ /?i=f&p=t&cid=$1 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文