2

Instead of using hash URLs for my SinglePageApplication I would like to use the HTML5 Browser History API. This works fine so far (I'm using emberjs).

The pro of the hash URL is, I can refresh the page without worrying about the result. When I try to reload with the browser history API I'll get a 404 (since my server don't have a route for this).

So: Is there a common workaround to avoid this behaviour?

I could tell my server to redirect to the index page but this wouldn't show me the correct content.

Example:

GET host/#images
... shows the "images" page (even when it is the index.html)

GET host/images
... redirect to host/
... shows me the content of the index template
boop
  • 7,413
  • 13
  • 50
  • 94
  • Can you add your `router.js` code and you `location` :ie 'hash' or 'auto' http://emberjs.com/guides/routing/specifying-the-location-api/ – kiwiupover Feb 06 '15 at 19:14

1 Answers1

2

Is https://stackoverflow.com/a/17288940/1423583 an answer to your question? Basically it says that you have to change the server to always serve the index.html page.

Community
  • 1
  • 1
Nathan
  • 1,418
  • 16
  • 32