How do I redirect all non-existent routes in iron:router?


With iron:router I’m basically just trying to make a global onBeforeAction that redirects to index. So I don’t want a notFoundTemplate to render but rather a full redirect, but I can’t seem to get it to work. What I’m doing now is:

var goToSplash = function() {


I’m assuming that it’s because of the but removing that yields the classic error of:

Route dispatch never rendered. Did you forget to call in an onBeforeAction?

Any tips?


Just add one more route at the last position catching all non-matched paths.


Thanks for the tip! For people wanting to setup a catchall this is from the iron-router docs (which I seemed to miss):

Iron Router now uses path-to-regexp, which means the syntax for catchall routes has changed a little -- it's now '/(.*)'.

Eg. in my case:

Router.route('/(.*)', {
  action: function() {