I am trying to get nginx to work with my pushState-based URI handling that backbone.js manages for me in an Javascript app.
R
Here is what i did to my application. Every route ending with a '/' (except the root it self) will serve index.html :
location ~ ^/.+/$ {
rewrite .* /index.html last;
}
You can also prefix your route :
Backbone.history.start({pushState: true, root: "/prefix/"})
and then :
location ~ ^/prefix/ {
rewrite .* /index.html last;
}
Or define a rule for each case.