8

そのため、バックボーンをいじっていて、pushState を使用する直接ページのロードが適切に機能しない場所に到達しました。my.url.com/login にアクセスしようとすると、見つからないページが表示されますが、それは直接存在しないためです。次の書き換えルールがあります。

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html [L,QSA]

これはうまくいかないようです(見つからないのではなく、悪いリクエストが返されると思います)。mod rewrite で pushState url を適切にロードするにはどうすればよいですか?

4

1 に答える 1

0

This is actually the first I'm reading of the new history API and how Backbone makes use of it -- pretty cool stuff.

To resolve your Bad Request problem, all you should need to do is prepend a / before index.html. On my end that redirects correctly internally and passes on the query string as you would expect.

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.html [L,QSA]
于 2012-04-26T01:52:48.390 に答える