国防部重写+哈希标签

模块重写与hashtags一起工作吗? 也许我的代码是废话,但这似乎并没有工作:

我的网站使用这个散列标签:index.php /#p / about

它使用正则hashtags工作正常,但我希望它与国防部重写所以我试着用:

RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)/?$ index.php#p/$1 [nc] 

我的js:

 $(window).hashchange(function(){ alert(location.hash); } $(window).hashchange(); 

输出不起作用,当我尝试国防部重写例如:

site.com/about

有任何想法吗?

哈希标签只是客户端,它们不会被发送到服务器,所以你不能重写到这样一个URL,但你可以用R标志重定向到它:

 RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)/?$ index.php#p/$1 [NC,NE,R=302]