Next.js Discord

Discord Forum

Custom 'not found' page in nextjs

Unanswered
Dwarf Crocodile posted this in #help-forum
Open in Discord
Dwarf CrocodileOP
I have made a folder [...not-found] inside my admin folder, so if a user try to go to any other route, he see a not found page.

is this the correect appraoch?

3 Replies

I’d like to know if you are implementing this because not-found.tsx wasn’t enough for you?
@LuisLl I’d like to know if you are implementing *this* because `not-found.tsx` wasn’t enough for you?
Dwarf CrocodileOP
i tried that, but it was not working (or maybe I did something wrong), then implemented this approach
Fair enough.
The thing is that you need to explicitly call the notFound() function in order to trigger the not-found.tsx file per route segment. Otherwise the root not-found.tsx will be rendered in place of any routes that Next.js couldn't find.