Yo,
I have a question becouse i can't solve it in my way. I need redirect all wrong urls ("example mywebsite.com/asdasdasdasd") to mywebsite.com/404. How can i do it? I try using a *.vue and _.vue in pages folder but when I try to type a wrong url my website crash on localhost either
If you use nuxt.js in
universalmode (which means that you have server-side code as well), then you can use Nuxt.js serverMiddleware.You could create a new
/serverMiddleware/redirects.jsfile with the redirect logic:Then add this as a
serverMiddlewareinnuxt.config.js:This is the simplest solution if you have some URLs to redirect. You could change this code to redirect all urls with a given pattern.