I have a simple html and css website. I was getting the infamous 404 NOT_FOUND until I found that I needed to create a vercel.json file and add the following:
However, now when I click on a page that is not the index.html, it shows me the index.html page but in the url shows the url of the page that I clicked on. In other words it only shows the home page when other pages are clicked on.
Hey @joemurrayaz. That configuration would work for something that handles routing, like an Express.js site. If your site is actually just HTML then this configuration is working as expected by only showing the home page.
If you go to the Source tab on the deployment details page, then toggle over to output, that will let you see which pages are included in the deployment and then paths to access them. Just make sure you remove the current rewrites configuration.
We have a list of other 404 debugging tips that can help you solve this.
But if you need more help, please share your public repo or a minimal reproducible example so we can work together from the same code to find the best solution for you
Yes. That configuration isn’t right for a plain HTML site. It would only be appropriate if you had a framework or library intentionally handling routing from the root path.
Something else was causing the 404, but it’ll be difficult to solve until you remove the rewrites config.