Next.js Discord

Discord Forum

custom 404 error page

Answered
Bohemian Waxwing posted this in #help-forum
Open in Discord
Bohemian WaxwingOP
I created
src/app/pages/404.js and /src/pages/404.js but it didn't work.

My "next": "14.2.5". Anyone facing the same problem?
Answered by joulev
are you using the app router or the pages router?

app router then it is src/app/not-found.js not src/app/pages/404.js
View full answer

5 Replies

@Bohemian Waxwing I created src/app/pages/404.js and /src/pages/404.js but it didn't work. My "next": "14.2.5". Anyone facing the same problem?
are you using the app router or the pages router?

app router then it is src/app/not-found.js not src/app/pages/404.js
Answer
I also removed .next folder and run npm run dev again, but nothing
@Bohemian Waxwing I tried src/app/404.js but remain the same.
i told you in the app router it is src/app/not-found.js.
but which router are you using?
@joulev i told you in the app router it is `src/app/not-found.js`. but which router are you using?
Bohemian WaxwingOP
Damnn... need to rename from 404.js to not-found.js. Now it work in src/app/. 2nd Damn I read documentation for pages route... the wrong one.. Thanks @joulev