.html 后的 htaccess 变量不显示

发布于 2025-01-04 01:55:06 字数 308 浏览 3 评论 0原文

如果有以下规则 RewriteRule ^userCP/([a-zA-Z]+).html /userCp.php?action=$1 我需要的是在 .html 之后以 .html?var1=asas 的形式捕获其他变量

我尝试过这个 RewriteRule ^userCP/([a-zA-Z]+)(\.html) /userCp.php?action=$1&vars=$2 但当然我花 2 美元得到的是.html

最终结果应该类似于 userCP/compose.html?id=1&return=0

if have the following rule
RewriteRule ^userCP/([a-zA-Z]+).html /userCp.php?action=$1
and what i need is to catch additional variables after the .html in the form of .html?var1=asas

i tried this
RewriteRule ^userCP/([a-zA-Z]+)(\.html) /userCp.php?action=$1&vars=$2 but of course all i'm getting for $2 is .html

The final outcome should look something like userCP/compose.html?id=1&return=0

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

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

发布评论

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

评论(1

拍不死你 2025-01-11 01:55:06

您所要做的就是添加 QSA 标志: 标记 QSA Apache 文档

RewriteRule ^userCP/([a-zA-Z]+).html /userCp.php?action=$1 [QSA,L]

All you have to do is add the QSA flag: Flag QSA Apache Docs.

RewriteRule ^userCP/([a-zA-Z]+).html /userCp.php?action=$1 [QSA,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文