.htaccess URL 重写问题
我在尝试重写其中包含 # 的 url 时遇到了问题。重写本身很简单:
RewriteRule ^accessories/access/Roll-Up-PR30/accessories.php#a485$ /alog/roll-up-product.php
但它只是失败了并且不会让我在那里拥有哈希值。
欢迎任何反馈,因为我已经没有想法了:S
I've run into a problem when trying to rewrite a url that has a # in it. The rewrite itself is simple:
RewriteRule ^accessories/access/Roll-Up-PR30/accessories.php#a485$ /alog/roll-up-product.php
But it just falls over and will not let me have the hash in there.
Any feedback is welcome as I am running out of ideas :S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,大多数浏览器(据我所知)不会将 URL 的片段部分发送到服务器,因此它在
.htaccess
中不可用;这只是客户端锚点查找。Unfortunately most browsers (that I know of) don't send the fragment part of the URL to the server so it's not available in
.htaccess
; it's just a client-side anchor lookup.看来哈希是一个特例。请参阅http://httpd.apache.org/docs/2.0/misc/rewriteguide。 html
相关部分是“扩展重定向”
It seems that hashes are a special case. See http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
The relevant section is "Extended Redirection"