How to create a 404 page in a NextJS project

Add a not-found.tsx file to the app folder. It works the same way as any page within the app router.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 10/09/2024 at 14:19
Last Updated on 10/09/2024 at 14:38
<p>A flower that represents NextJS with the text "404" beneath it.</p>

Add a not-found.tsx file to the app folder. It works the same way as any page within the app router.

SubscribeDownload Open Source Project
<p>A screenshot of VSCode showing the not found page within the student archive.</p>

To create a 404 page within an app router, create a not-found.tsx file.

It will work the same as any page within the app router.

If you are not familiar with the NextJS app router, consult the link below.

How the NextJS app router works

Looking to learn more about NextJS, ReactJS or web development?

Search our blog to find educational content on NextJS, ReactJS and web development.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe