🔧 Unbreak My AppAll fixesFix KitsSponsor

Fixes › Deploys

404 NOT_FOUND when refreshing a page (React/Vite SPA)

LovableBolt

The error

404: NOT_FOUND on /dashboard after refresh or when opening a direct link

Why it happens

Vite/React Router apps are single-page apps: only index.html exists. The host looks for a /dashboard file, finds none and returns 404. You need a rewrite to index.html.

How to fix it

  1. On Vercel add vercel.json: {"rewrites":[{"source":"/(.*)","destination":"/index.html"}]}
  2. On Netlify add public/_redirects with: /* /index.html 200
  3. Redeploy and test a deep link.

Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)

Direct links and refreshes on routes like /dashboard return 404 after deploying this Vite + React Router app. Add the correct SPA fallback for <Vercel/Netlify> (vercel.json rewrites to /index.html, or a _redirects file) without breaking /api routes, and confirm deep links work.

FAQ

Why does the home page work?

/ maps to index.html, which exists; other paths don't.

Will this break API routes?

Vercel serves real files and functions before applying rewrites.

Related fixes

Want the full checklist for this area? Get a Fix Kit ($29)

Get one new fix a week

Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.

We only use your email to send the newsletter. Unsubscribe any time. See privacy.