帮助理解为什么这个重写不起作用?

发布于 2024-10-03 14:47:41 字数 448 浏览 0 评论 0原文

我有这样的:

 RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=$1 [NC]

当输入这样的网址时:“domain.com/show_shop/4”然后获取网址,并显示“show_shop.php”。所以重写是有效的。

但是,斜杠后面的 nr 不起作用。我使用这段代码:

  $id = $_GET['id'];

但它的结果是空白,即什么都没有。不是按照php设置的。

这可能是什么原因造成的。

仅供参考,我有很多像这样的其他规则,它们工作正常,但是这个似乎很麻烦...

像这样的“show_shop.php?id=4”手动输入 URL(真实的 url)工作正常,并且id 是 GET,一切都很好。

有什么想法吗?

I have this:

 RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=$1 [NC]

When entering the url like this: "domain.com/show_shop/4" then the url is fetched, and "show_shop.php" is displayed. So the rewrite kindof works.

However, the nr behind the slash doesnt work. I use this code:

  $id = $_GET['id'];

but it results in blank, ie nothing is there. It isn't set according to php.

What could be the cause of this.

FYI I have plenty of other rules just like this, and they work fine, but this one seems to be troublesome...

Entering the URL manually (the real url) like this "show_shop.php?id=4" works fine, and the id is GET and all is fine.

Any ideas?

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

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

发布评论

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

评论(2

不弃不离 2024-10-10 14:47:41

尝试 QSA 标志

RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=$1 [NC,QSA]

Try the QSA-Flag

RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=$1 [NC,QSA]
月棠 2024-10-10 14:47:41

不应该是 % 而不是 $

RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=%1 [NC]

Shouldn't it be % rather than $

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