.htaccess 中的“哈希"网址重写 [英] 'hash' url rewrite in .htaccess
本文介绍了.htaccess 中的“哈希"网址重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用 http://example.com/articles/first-article
重写 http://example.com/articles.html#first-article
是否可以重写?
我尝试使用以下方法但对我不起作用:
I tried using following but didn't work for me:
RewriteRule ^articles/(.+)$ /articles.html#$1
推荐答案
不,这不可能.URL 片段(从 #
开始的所有内容)甚至不会发送到服务器.
No, it's not possible. The URL fragment (everything from #
on) not even gets sent to the server.
也许您想考虑基于 JavaScript 的解决方案,其中实际内容将通过依赖于片段的 AJAX 加载.您可以在此处找到有关此方法的一些有用信息:Facebook 和新 Twitter 网址中的 shebang/hashbang (#!) 是什么?
Maybe you want to consider a JavaScript based solution, where the actual content will be loaded via AJAX dependent on the fragment. You will find some useful information about this method here: What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?
这篇关于.htaccess 中的“哈希"网址重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文