404 Page not found when refreshing a page
- Vercel
- Netlify
- Single-page apps
What it means
Your app's pages exist only in the browser. When someone opens /dashboard directly, the host looks for a file with that name, finds none, and returns 404.
Why it happens
- A single-page app (React, Vite) deployed without a rewrite rule.
- The rule exists but in the wrong file or folder for your host.
How to fix it
- Add a rewrite that sends every path to index.html (Netlify: a _redirects file with '/* /index.html 200'; Vercel: a rewrite in vercel.json).
- Redeploy and open a deep link directly to confirm.
- Pages people should find in search need real HTML too: check them with 'Can Google see your app?'.
Let your AI find the cause
Paste this into Claude Code, Cursor, Lovable or whichever AI built your app. It looks first and changes nothing until you have read the answer.
My deployed app shows 404 when I refresh a page or open a link directly. Without changing anything yet, tell me which framework and router this project uses, where it is hosted, and the exact rewrite rule and file my host needs.