Vercel 404: NOT_FOUND when refreshing a page or opening a direct link
Home page works on Vercel but refreshing /dashboard gives 404 NOT_FOUND? Add a rewrite to index.html for your single-page app.
Reviewed October 14, 2026
What it means in plain English
Lovable and Bolt build "single-page apps": there's really only one HTML file and the app draws each page in the browser. When you refresh /dashboard, Vercel looks for a file called dashboard, finds none, and shows 404.
Likely causes
- No SPA rewrite rule in
vercel.json. - Wrong output directory (e.g. Vercel serving the repo root instead of
dist).
How to fix it, step by step
- In the project root, create (or edit)
vercel.json:
{
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}
- Vercel serves real files first, so images, JS and CSS keep working.
- Check Project → Settings → Build & Development: framework Vite, output directory dist.
- Commit and push (or ask Lovable/Bolt: "Add a vercel.json SPA rewrite to index.html") and let it redeploy.
- Next.js apps don't need this; a 404 there means the route file truly doesn't exist.
How to check it worked
- Open
https://yourapp.com/some-inner-pagedirectly and press refresh; it should load. - Check a missing route shows your app's own 'not found' screen.
Sources
Related fixes
Can't fix it? Get help.
If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.