Issue Description:
I’m experiencing issues with navigation between pages after deploying my project on Vercel. The project works perfectly locally, and I can navigate between pages without any problems. However, after deploying to Vercel, some pages do not load or result in 404 errors when navigating.
Project Links:
GitHub Repository
https://github.com/FadyFathey/digitalize-v.2.git
Vercel Deployment:
https://digitalize-v-2.vercel.app/
Project Structure:
DIGITALIZE-V.2
├── AboutUs
│ └── html
│ └── digitalize
│ ├── assets
│ └── about.html
├── blogs
│ └── html
│ └── digitalize
│ ├── assets
│ └── blogs.html
├── blogs-details
│ └── html
│ └── digitalize
│ ├── assets
│ └── blog-details.html
├── contact us
│ └── html
│ └── digitalize
│ ├── assets
│ └── contact.html
├── ourServices
│ └── html
│ └── digitalize
│ ├── assets
│ └── service.html
└── vercel.json
Current vercel.json Configuration:
{
"version": 2,
"rewrites": [
{
"source": "/about",
"destination": "/AboutUs/html/digitalize/about.html"
},
{
"source": "/contact",
"destination": "/contact us/html/digitalize/contact.html"
},
{
"source": "/ourServices",
"destination": "/ourServices/html/digitalize/service.html"
},
{
"source": "/blogs",
"destination": "/blogs/html/digitalize/blogs.html"
},
{
"source": "/blog-details",
"destination": "/blogs-details/html/digitalize/blog-details.html"
},
{
"source": "/(.*)",
"destination": "/html/digitalize/index.html"
}
],
"cleanUrls": true,
"trailingSlash": false
}
What I’ve Tried So Far:
Modified vercel.json: I tried different configurations for the rewrites, but navigation between pages still doesn’t work as expected. Verified Folder Structure: I confirmed that the folder structure on Vercel matches the local structure exactly. Tested Links: Links work locally, but after deployment, Vercel does not recognize some pages.
I tried removing all rewrites except for "source": "/(.*)" as you recommended, but I’m still facing the same issue where the pages don’t navigate correctly and some routes return 404 errors
Question:
How can I configure vercel.json to ensure that navigation between pages works correctly after deployment? Are there specific rewrite configurations I’m missing to fix this navigation issue?