not-found inside route groups
Unanswered
Exotic Shorthair posted this in #help-forum
Exotic ShorthairOP
I can’t have a global not-found because I have 2 separate route groups each with a layout in it however when I put the not-found files inside it it doesn’t work and reverts back to the default nextjs 404 page how do I fix this?
App directory
App directory
1 Reply
American black bear
I had the same problem and found a post that said to add a catch all route [...notFound]/page.tsx with the following, which worked for me.
import { notFound } from "next/navigation";
export default function NotFoundCatchAllPage() {
notFound();
}
import { notFound } from "next/navigation";
export default function NotFoundCatchAllPage() {
notFound();
}