在.htaccess'散'URL重写 [英] 'hash' url rewrite in .htaccess
问题描述
我想重写 http://example.com/articles.html#first-article
与 http://example.com/文章/第一条
是否有可能重写?
我尝试使用下面的,但对我没有工作:
重写规则^文章/(.+)$ /articles\.html\#$1
没有,这是不可能的。在网址片段的(一切从#
上)甚至没有被发送到服务器。
也许你要考虑一种基于JavaScript的解决方案,其中实际的内容将通过AJAX加载依赖的片段上。你会发现这里这个方法的一些有用的信息:<一href="http://stackoverflow.com/questions/3009380/whats-the-shebang-hashbang-in-facebook-and-new-twitter-urls-for">What's该家当/ hashbang在Facebook和Twitter的新网址(#!)什么?
I want to rewrite http://example.com/articles.html#first-article
with http://example.com/articles/first-article
Is it possible to rewrite?
I tried using following but didn't work for me:
RewriteRule ^articles/(.+)$ /articles\.html\#$1
No, it's not possible. The URL fragment (everything from #
on) not even gets sent to the server.
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'散'URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!