Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting urls without hashes in Ember.js on Github Pages

I wanted to get rid of ugly hash tags in my url (www.example.com/#/projects/id -> www.example.com/projects/id). So I added

Router.reopen({
    location: 'history'
});

This works if I open my app to the root www.example.com, and click on a link-to I can visit www.example.com/projects and so on. However, if I put www.example.com/projects in my url bar and load the page that way, we get a 404 error. It makes sense to me why that would happen (after all, the server is only serving the javascript assets on the one url). I'm using github pages for my site, what approach should I use to make this work?

like image 765
Savanaly Avatar asked Mar 15 '26 21:03

Savanaly


1 Answers

Basically your server needs to serve your index.html file no matter what url is entered.

Keep in mind that your server must serve the Ember app at all the routes defined here.

More in the docs

like image 88
getdave Avatar answered Mar 18 '26 05:03

getdave