Watch: Fix 404 on page refresh in a React single-page app | Vovy

Watch Vovy do it on a Mac: "My app works but refreshing any page gives a 404 Not Found". Vovy adds the rewrite rule your single-page app needs so every link loads your app, on Vercel, Netlify or Cloudflare Pages.

"My app works but refreshing any page gives a 404 Not Found"

Vovy adds the rewrite rule your single-page app needs so every link loads your app, on Vercel, Netlify or Cloudflare Pages.

What happens in the video

  1. Reproduce the 404: Vovy opens a deep link like yoursite.com/dashboard directly. Clicking works, but a fresh load asks the server for a file that doesn't exist.
  2. Explain why it happens: Apps built with Vite, like Lovable and Bolt exports, have one real page, index.html. The browser handles the other routes, so the server needs to be told.
  3. Add the rewrite rule: Cursor adds a rewrite in vercel.json sending every path to index.html, or a _redirects file with /* /index.html 200 for Netlify.
  4. Deploy the change: Vovy commits and pushes the config file after you approve and waits for the deploy to finish.
  5. Test every route: It loads each of your routes fresh and shows a table of path and status, all 200.
Read the step-by-step guide