2013-02-23 128 views
0

是否有一个htaccess重写我可以部署这将使http://example.com/about在页面上显示相同的位置http://example.com/#about?如果不是,我可以用jQuery来做到吗?.htaccess重写链接作为锚链接

+0

检查[http://stackoverflow.com/questions/2872490/how-to-use-htaccess-to-rewrite-url-to-html-anchor-tag](http://stackoverflow.com/questions/ 2872490/how-to-use-htaccess-to-rewrite-url-to-html-anchor-tag)和[http://stackoverflow.com/questions/2285193/htaccess-redirect-to-page-with-anchor-链接](http://stackoverflow.com/questions/2285193/htaccess-redirect-to-page-with-anchor-link) – 2013-02-23 17:16:47

回答

0

在这里,我明白了。它并不完美(它重定向到锚,所以你在URL中看到它),但它为我工作:

RewriteEngine On 
RewriteRule ^([a-zA-Z0-9_]+)$ /\#$1 [R,NE] 

如果你用这个,http://example.com/about将成为http://example.com/#about