Default 404 page doesn't seem to work.
Answered
Checkered Giant posted this in #help-forum
Checkered GiantOP
I am trying to create a default 404 page, but it seems like its not working. I've attached relevant images.
19 Replies
Checkered GiantOP
If i move the not-found.jsx to app/[locale] it also doesn't seems to work. All I get is default next.js not found error, not my custom jsx page.
American Chinchilla
@Checkered Giant
American Chinchilla
Have you tried .js
Answer
@American Chinchilla Have you tried .js
Checkered GiantOP
Thanks it did worked !!
American Chinchilla
Thats wherei found it
It only mentions 2 file extensions
.tsx or .js
Np
:marked
::marked
Checkered GiantOP
@American Chinchilla actually it again throwing an error. It rendered the time I changed the extension. But now its broken.
I tried importing a common component and using it,
@Checkered Giant I am trying to create a default 404 page, but it seems like its not working. I've attached relevant images.
1. add an empty app/layout.js
2. add
export default function Layout({ children }) {
return children;
}
2. add
<html>
and <body>
tags to the app/not-found.js
.js, .jsx and .tsx all work, so changing the file extension is not the solution
@joulev 1. add an empty app/layout.js
tsx
export default function Layout({ children }) {
return children;
}
2. add `<html>` and `<body>` tags to the `app/not-found.js`
Checkered GiantOP
it did worked though but it seems to be failing build.
Checkered GiantOP
here is my layout.js file