htaccess mod 重写
我在重写 url 时遇到问题。我有以下规则工作正常:
RewriteRule ^([^/\.]+)/?/([^/\.]+)/?$ page.php?theme=$1&pg=$2 [L]
显示网址如下:
domain.com/theme/pg
我需要将网址重写为 domain.com/theme#pg
我认为以下内容可以工作,但事实并非如此't:
RewriteRule ^([^/\.]+)/?#([^/\.]+)/?$ page.php?theme=$1&pg=$2 [L]
我做错了什么?
I'm having trouble with url rewriting. I have the following rule working fine:
RewriteRule ^([^/\.]+)/?/([^/\.]+)/?$ page.php?theme=$1&pg=$2 [L]
which displays the url as follows:
domain.com/theme/pg
What i need is for the the url to rewrite to domain.com/theme#pg
I thought the below would work, but it doesn't:
RewriteRule ^([^/\.]+)/?#([^/\.]+)/?$ page.php?theme=$1&pg=$2 [L]
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
URL 中的
#
是客户端的东西 - 你根本不应该在服务器上获取它。您可以重写到包含锚点的URL,如下所示:但不来自包含
#
的URL - 根本无法到达服务器。#
in the URL is the client-side thing - you should not get that on the server at all. You can rewrite to the URL containing an anchor, as given e.g. here:but not from the URL containing a
#
- that would not get to the server at all.