尝试在 .htaccess 中创建重写规则

发布于 2024-12-25 16:13:39 字数 279 浏览 0 评论 0原文

我有一个类似于

www.myurl.com/page/blog

的网址,它与我当前的重写规则配合得很好。但是当我尝试向其附加附加查询字符串时,它不起作用。

www.myurl.com/page/blog?group=2

是否可以在重写规则中添加一些内容,使其捕获所有其他查询字符串?

这是我目前的规则:

 RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

I have a url that looks like this

www.myurl.com/page/blog

which works fine with my current rewrite rule. But when I try to append append additional query stings to it it doesn't work.

www.myurl.com/page/blog?group=2

Is there something I could add to my rewrite rule that will make it catch all additional query strings?

This is my current rule:

 RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

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

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

发布评论

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

评论(1

聽兲甴掵 2025-01-01 16:13:39

您需要添加 [QSA] 标志来传递原始查询字符串参数,即

RewriteRule ^page/([^/.]+)/?$index.php?page=$1 [L,QSA]

You need to add the [QSA] flag to pass through the original query string params i.e.

RewriteRule ^page/([^/.]+)/?$ index.php?page=$1 [L,QSA]

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