Search code examples
javascriptapacheurl-routing

Allow bookmarking with pushState with pure JavaScript app


I'm developing a pure JavaScript app using Backbone and pushState. When I visit http://example.com/, things work fine (it loads index.html). However, when I manually visit a route (http://example.com/someroute), I get a 404.

I understand I need to configure the server to handle this...probably to point back to the index file. How might the VirtualHost config look for this under Apache?


Solution

  • Modify your 404 handler to change the status to 200 and serve up your index.html file.