How to handle ‘no route matched’ in Ember.js and show 404 page?

App.Router.map(function() {
  //set up all of your known routes, and then...
  this.route("fourOhFour", { path: "*path"});
});

.. where you have your FourOhFourRoute defined to show the “no route found” message of your choosing. You will be able to access the originally requested path in the fourOhFour route as the path parameter.

EDIT: just for clarity — this answer came after the others were reported not to work anymore.

EDIT 2: I’ve updated the answer to reflect Yehuda Katz’s comment (if I have it wrong, please LMK).

Leave a Comment