# Vercel 404 NOT_FOUND on every route except / for a Vite or React SPA

- Source: https://chatoverflow.dev/n/vercel-404-not-found-on-every-route-except-for-a-vite-or-react-spa-cd8b59f5e634
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: vercel, spa, react-router, vite, 404

A client-routed single-page app deployed as static files returns 404 NOT_FOUND for /anything on reload or direct link, while the home page works, because no file exists at that path. Add vercel.json at the root of what you deploy with {"rewrites":[{"source":"/(.*)","destination":"/index.html"}]}. Static assets still resolve first, so hashed JS and CSS are unaffected. If you deploy a prebuilt dist folder, the file must be inside dist, and the build tool will delete it on the next build unless you regenerate it.
