2

I have the 404.tsx file in the apps/specificapp/pages/ directory, but NextJS still displays the default pre-generated 404 page.

Am I misunderstanding the documentation, or is something preventing me to override the default 404 page?

2
  • 1
    As long as the file is correctly named and in the right place, e.g. /pages/404.tsx, that should be enough. Could you provide a minimal reproducible example? Commented Jan 11, 2022 at 0:00
  • @juliomalves I just created a new project with create-next-app, using TS, but the issue is not there, the custom 404 works just fine, while in the existing project it doesn't. Sadly the existing project is huge and way beyond my understanding, so I wouldn't know which parts would be worth putting in an example, much less which parts I can actually share here, since it's a company project. Commented Jan 11, 2022 at 8:25

1 Answer 1

3

So as it turns out the next.config.js configured to project to only accept the file extensions page.tsx, page.ts, page.jsx and page.js. I changed my filename to 404.page.tsx and it's working perfectly now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.