From the course: The Freelance Stack: Real Project with Next.js and Strapi

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Not found pages

Not found pages

Cool, so now we have it set up that if we put in an ID here that doesn't exist, we see this 404 page here, right? Because we said we only want to display anything for the kind of parameters that are coming in here. Now the thing is, we can also create our own 404 page. So if I go into my app directory here and I just add a not found JSX right here and I say this is a new page and I'm just saying sorry in an h3. Sorry we couldn't find what you're looking for Like this now if I go back There we go. Sorry, we couldn't find what you're looking for now That would be happening on every route that is just wrong right like here. We see it if we go to home page Uh, it wouldn't appear but then on any route that we haven't actually defined we will show this page It could be though that you actually want to have a situation in which you want to have for specific route segments different not found pages. So if we go back into Excalidraw, this here for example would be a route segment, right? So…

Contents