我无法在我的网站上使用此功能:
# BEGIN pushState Routing
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^/tournament/(0-9)+$ /#tournament/$1 [R=301,NE,L]
# END pushState Routing
当我...example.com/tournament/11
时,我会收到404.它应该重定向到example.com/#tournament/11
,以便Backbone.js
启用pushState并删除主题标签。
答案 0 :(得分:0)
试试这段代码:
# BEGIN pushState Routing
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} =80
RewriteRule ^/?(tournament/\d+)/?$ /#$1 [R=301,NE,L,NC]
# END pushState Routing
.htaccess
中的前导斜杠不匹配,所以最好使其与.htaccess和Apache配置兼容。