So I am playing around with backbone and have gotten to the put where loading direct pages that use pushState don’t work properly. if I try to go to my.url.com/login it gives me a not found page which it should because that directly does not exist. I have the following rewrite rule:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html [L,QSA]
hoever this does not seems to work (thought with it I get a bad request instead of not found). How can I get pushState url to load properly with mod rewrite?
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
/beforeindex.html. On my end that redirects correctly internally and passes on the query string as you would expect.