我试图实现{ pushState : true }
,但它只能用于基本路线,不与其他那些继续给我错误404骨干pushState的和错误404
在Chrome中,如果我访问:
http://example.app/ - OK显示控制台消息
http://example.app/show - 错误404返回
我的路线是
var AppRouter = Backbone.Router.extend({
routes: {
'': 'index',
'show': 'show'
},
index: function() {
console.log('This is the index page');
},
show: function() {
console.log('This is the show page');
}
});
new AppRouter;
Backbone.history.start({pushState: true});
我的.htaccess
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
什么我失踪或者我做错了吗?
是啊,叹了口气。希望我的后端只写了自己 – 2013-03-12 01:12:19
这个答案应该被接受 – alejoss 2014-11-15 01:48:21