404 Page
Unanswered
Mugger Crocodile posted this in #help-forum
Mugger CrocodileOP
I am using nextjs v15. I am using both the app router and the pages router side by side in the same project. If I have a /app/not-found.tsx will /pages/404.tsx ever be used. If it's not used is it safe to delete it?
5 Replies
Honestly the easiest way to test this is to make different 404 pages for app/ and pages/ routers, and then trigger them by requesting a page that doesn’t exist in each section.
First see if each router triggers its own not found fallback. Then delete the one of them.
If deleting the one from /pages still triggers the one from app, then you should be safe to delete it for good👍
First see if each router triggers its own not found fallback. Then delete the one of them.
If deleting the one from /pages still triggers the one from app, then you should be safe to delete it for good👍
@Mugger Crocodile I am using nextjs v15. I am using both the app router and the pages router side by side in the same project. If I have a /app/not-found.tsx will /pages/404.tsx ever be used. If it's not used is it safe to delete it?
If both routers are in use, /pages/404.tsx will still be used for routes handled by the Pages Router.
@DEV_2.0 If both routers are in use, /pages/404.tsx will still be used for routes handled by the Pages Router.
Mugger CrocodileOP
Actually I didn't find this to be the case in
15.1.6
. Unless something else is going on that I am not understanding.it's depend on how you are doing routing
Mugger CrocodileOP
So i have a route
/pages/[slug]/[...handle].tsx
when I go to route /sdfg/dfgsdfgsdf
it tries to fallback and getStaticProps
. Because the resource does not exist getStaticProps
returns { notFound: true }
. Which I would expect to display the pages router 404, but it seems to return the app router 404.