Problem Explanation:
I’m experiencing a 404 error when directly accessing routes on my Vite SPA (Single Page Application). The vercel.json rewrite configuration is correctly set up and located in the root directory of my repository, but it appears to not be applied during deployment.
Current vs Expected Behavior
Current Behavior:
Navigating to /about from within the app (client-side routing) works perfectly
Directly visiting www.nanirex.com/about in a new browser tab returns a 404 “Not Found” error
Even the specific deployment URL returns 404: https://nanirexv2-qc48wxxmp-timinanaye-2681s-projects.vercel.app/about
Expected Behavior:
Directly visiting www.nanirex.com/about should serve index.html and allow the client-side router to handle the route
The vercel.json rewrites should catch all routes and redirect to index.html
Code, Configuration & Steps to Reproduce
My vercel.json (located in repository root):
{
“rewrites”: [
{ "source": "/(.\*)", "destination": "/index.html" }
]
}
Steps to reproduce:
Open a new browser tab
Navigate directly to www.nanirex.com/about
Observe 404 error
What I’ve already tried:
Verified vercel.json is in the repository root
Confirmed file is committed to Git (not in .gitignore)
Multiple redeployments
Checked Root Directory setting in Vercel project settings
Project Information
Info Value
Production URL www.nanirex.com
Framework Vite (selected “Other” in Vercel)
Output Directory dist
Build Tool Lovable
Issue Duration Since initial deployment (never worked)
Any help would be greatly appreciated! It seems like the vercel.json is being ignored during the build process.