#Automatically redirect to /404 when visiting a page that doesn't exist
4 messages · Page 1 of 1 (latest)
I would look into a middleware in the top layout.tsx to see when nothing matched and then do redirect.
(but just guessing here)
Tried it with this code, but the problem is that even if I have the info about the pathname before loading the page, I don't have a way to check if that route exists until it fails, and after that I cannot do any action like a redirection to my /404 🤔