NuxtN
Nuxt9mo ago
5 replies
bnthor

Redirect 404 pages from a middleware

Hi there, i'm currently working on my company's new website with Nuxt 3.17.

This new site will be AB tested and some of the old site's pages won't be implemented from the start in the new version.

I need to detect routes that are 404 in the new website and to redirect these to the equivalent page on the old website...

For example a route that doesn't exist like new.mydomain.com/nope should redirect to www.mydomain.com/nope

I thought I could intercept these unimplemented routes from a middleware but I can't find any documentation online.

Is this even a good idea or are there some better practices ?

Thanks !
Was this page helpful?