routes return 404 not found error in next.js
Unanswered
Mallow bee posted this in #help-forum
Mallow beeOP
i created a route in a next.js application called home.js inside a directory called pages with some code in it but when i tried to navigate to it by typing ''http://localhost:3000/pages/home" in the url bar in the browser, it returns the error page with warning message '404 | page could not be found'. I am seeking help from experts. Thank you.
14 Replies
Mallow beeOP
this is the remote repo if you want to see the whole image and clone it: https://github.com/Alharith-Albayati/test.git
repo is private
@joulev repo is private
Mallow beeOP
I made it public now
@Mallow bee i created a route in a next.js application called home.js inside a directory called pages with some code in it but when i tried to navigate to it by typing ''http://localhost:3000/pages/home" in the url bar in the browser, it returns the error page with warning message '404 | page could not be found'. I am seeking help from experts. Thank you.
app dir:
pages dir:
you need one of the above files for
app/pages/home/page.jspages dir:
pages/pages/home.js or pages/pages/home/index.jsyou need one of the above files for
/pages/home to work, you don't have it so it returns 404@joulev app dir: `app/pages/home/page.js`
pages dir: `pages/pages/home.js` or `pages/pages/home/index.js`
you need one of the above files for `/pages/home` to work, you don't have it so it returns 404
Mallow beeOP
i tried making those directories but it failed again
not seeing it in the reproduction repo
Mallow beeOP
hold on
Mallow beeOP
which branch
Mallow beeOP
noor
rename your
app/pages/home/home.js to app/pages/home/page.jsMallow beeOP
it does not work again
Shhh just read the routing documentation, https://nextjs.org/docs/app/building-your-application/routing
Mallow beeOP
I already read it but it does not work.. the problem started after I read it. Thank for helping anyway (: