I’m deploying a React + Vite SPA to Vercel (not using Next.js), and I’m seeing Vercel’s default 404 page on client-side routes like /profile, even though the root (/) loads correctly.
What I’ve Tried:
Rewrite to /index.html in vercel.json
Ensured vite.config.js includes base: '/'
Removed framework field from vercel.json
Set project preset to "Other" in Vercel
Cleared cache and redeployed multiple times
Confirmed the route works locally with npx serve dist
index.html is present and served for root /
What’s Happening:
SPA routes like /profile return Vercel’s generic 404
Vercel appears to ignore the rewrite rule in vercel.json
The app never loads → React Router never takes over
I believe this may be a deeper issue with how rewrites are applied to non-Next.js frameworks, or potentially a conflict with internal defaults.
Appreciate any help or confirmation from the Vercel team
This should generally work out of the box, so it’s hard to say exactly where you’re going wrong. If you can share your repo or a minimal reproduction I can help further
Here’s a fresh example repo of running a Vite + React Router 7 SPA (using the plain react vite plugin), with demo link available
I’ve run this past a few people who couldn’t identify any obvious issues, and though I found topics posted in the community describing the exact same issue, none of them had solutions posted.
Thank you in advance for any help or guidance you can provide. If you need any more information from me, please let me know!
The issue was that cleanUrls: true removes the .html from paths, so your destination rewrite needs to also remove it. I’ll reach out internally and see if we can get this documented