404 when you refresh a page on Vercel or Netlify? Add a rewrite

Ship ItChecked against the official source

The short answer

Many vibe-coded apps are single-page apps, for example Vite + React: the browser loads one index.html and the app draws each page itself. When you refresh a deep link like /dashboard, the host looks for a file at that path, finds none, and returns 404 NOT_FOUND. The fix is one rewrite rule that serves index.html for every path.

What to do

  1. On Vercel, create vercel.json at the root of your project with a rewrite from "/(.*)" to "/index.html".
  2. On Netlify, add the rule /* /index.html 200 to your _redirects file.
  3. Ask your AI tool: "This is a single-page app. Add the rewrite rule for Vercel (or Netlify) so refreshing any page loads index.html."

Good to know

  • This is for single-page apps only. Next.js and other server-rendered apps route differently.
  • Not every Lovable app is a single-page app: Lovable hosting has server-side rendering since May 2026.

Source

Checked on 8 Oct 2026. Prices, limits and settings change, so check the source before you rely on them.