Vue-router redirect on page not found (404)
I'm trying to redirect to 404.html on page not found using the router.beforeEach global hook, without much success (using Vue and Vue-Router 1.0): router.beforeEach(function (transition) { if (transition.to.path === '/*') { window.location.href = '/404.html' } else { transition.next() } }); This is not redirecting to page 404.html when a non-existing route is inserted, just giving me an empty fragment. Only when hard-coding some-site.com/* will it redirect to the expected some-site.com/404.html I'm sure there's something very obvious here that I'm overlooking, but I cannot figure out what.