2013-02-23 186 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