404 Routes in `/app` directory
Describe the feature you'd like to request
404 Routes in /app directory
This is a feature request about being able to add 404 routes in the /app directory. There's no exact point to stick with, but I think it will be massively appreciated if this feature gets added.
Describe the solution you'd like
Being able to add a 404 page in the /app directory.
Describe alternatives you've considered
I've been putting my 404 page in my /pages folder.
@Zeptar1069 , Next.js 13 offers alternative way of implementing 404 pages, Documentation link below, in case if you missed out.
https://beta.nextjs.org/docs/api-reference/notfound https://beta.nextjs.org/docs/api-reference/file-conventions/not-found
@vigneshshiv I added a not-found page to the app/feed but it's not working when I put 404.TSX to the pages directory, it works fine on development mode but it is causing problems after building the app. getting and runtime error on the prod build
@RazorRSD Are you using feed as a router inside app directory? If not you can place it in the exact route directory and check.
It would be better, if you could provide more details like app structure or any codepen link as a reference.
It sounds like a bug rather than a feature request, as https://beta.nextjs.org/docs/api-reference/file-conventions/not-found should be the answer here. Could you attach your repo so we can have a look?
I thought I stumbled across the same issues, but while trying to reproduce everything works, which is always great :)
The one thing I would might improve upon is explaining in the not-found documentation that you cant use notFound()/not-found.tsx to handle requests that go towards pages that do not exist. Took some googling to find out I still had to use the pages directory with a 404.tsx file to handle this.
I assume that the not-found.tsx file will replace this some time in the future?
Reproduction repository here if anyone wants to confirm/play around.
I have been having the same issue, have you find a solution to have a notfound page with the app directory?
I have been having the same issue, have you find a solution to have a notfound page with the app directory?
If you read my comment right above yours, you can find a repository where this is implemented. The app directory does not currently have a global 404 page for non-existent pages, therefore you need to still use the pages directory for this functionality.
Alright, thank you for all of the support! I've managed to find the solution, thanks to @Gawdfrey and @vigneshshiv
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.