Page not found when I reload
Unanswered
.dric posted this in #help-forum
.dricOP
I'm having a problem where when I reload the page, it brings me to a 404 not found (page not found), although the page exists.
When I click a
Is there a way to handle this error, or how can a fix it at once.
Here's the website: https://dkidfuego.web.app/
I'm using the App router/directory by the way (src/app).
Please let me know if need to see the Navbar component.
When I click a
<Link> sending my to another page (url.../page) in the Navbar, it works fine, but when I reload on that page it sends me to a 404 not found.Is there a way to handle this error, or how can a fix it at once.
Here's the website: https://dkidfuego.web.app/
I'm using the App router/directory by the way (src/app).
Please let me know if need to see the Navbar component.
39 Replies
Eurasian Woodcock
Are you getting any error in the browser console or terminal?? Mostly seems like a server side error 🔥
.dricOP
let me check rq
the directory exists in the files tho
Eurasian Woodcock
Any error on server terminal?
Also please share ss of directory
.dricOP
okay
I don't get a 404 page not found error when I run it locally
Eurasian Woodcock
Yes directory looks good
Do you have any logs from server ? Might get actual issue from there
.dricOP
are you talking about the terminal
Eurasian Woodcock
Yes
Not local, I want to see logs of the server where your website is hosted
Eurasian Woodcock
Try putting the app folder in the root and delete the src folder
As per doc app need to be at root level
.dricOP
but what's the problem with src/ routing
are you using the static export option to deploy your app?
@Rafael Almeida are you using the static export option to deploy your app?
.dricOP
the one that uses next export in next.config.ts/js ?
im pr
im pretty sure it's a static export
if you are using it then the issue is probably with the deploy, it is not configured correctly to route the paths to each generated page file
.dricOP
okay i'll check that out
@Rafael Almeida this: <https://nextjs.org/docs/app/building-your-application/deploying/static-exports>
.dricOP
ok i noticed i was using BOTH of the exports. I removed
output: export from next.config.mjs and that leaves me with "export": "next export" in package.json. I did npm run build && npm run export and deployed the files to my hostim still getting the same error though
I'm using Firebase host
the updated version uses the former option so I suggest keeping it
and you can remove this
export script, with output: 'export' you can just run build and it will output the static files.dricOP
oh ok
so just output: 'export'
for the deploy, you need to check a firebase guide that explains how to host SPAs that use pages as individual files
Is it just better to use vercel to deploy nextjs apps
yeah vercel is one of the easiest, I am not really familiar with firebase to give you proper instructions
.dricOP
yeah i might just switch to vercel
thank you for your help guys!
Eurasian Woodcock
Yeah I'm also using Vercel, it's best for nextjs