I have currently created a pages/404.vue
file, then, in my server settings, I redirect any non existent url to /404.html (the generated page).
Apart me having to declare the file extension (it gives me redirect error if I redirect to /404), it seems to work fine, and I guess it will also give me an easy way to create other server error files, if needed.
However, following the documentation, I first tried adding fallback: true
inside generate:{ }
. This creates a 404.html
page in my root, but using a default Nuxt layout (an infinite loading wheel page).
I assumed that creating layouts/error.vue
(as per docs) would do the trick, but didn't seem the case.
What is the right practice, and, if the documentation one is to follow, why my personalised error.vue wasn't working? Thanks.