# "Page Not Found" / "404: NOT_FOUND" when you refresh or open a deep link in your deployed React app

- Fix ID: APP-02
- Exact error: `Page Not Found`
- Status: Partially verified (CI: pending, no CI results exist yet)
- Last verified: 2026-10-26
- Platforms: Netlify, Vercel, Lovable, Bolt, Cursor
- Versions: os=Debian 13 (container); node=20.19.2; vite=8.3.5; react=19.3.1; react-router-dom=7.18.4; netlify-cli=27.14.2 (offline emulator)
- Repro: https://stucktoshipped.com/repros/APP-02/ (file hashes only; files are in the paid repro bundle)
- Canonical: https://stucktoshipped.com/fixes/netlify/page-not-found-on-refresh/

## In brief
Your single-page app needs a fallback rule on the host. The full fix gives the exact file and line for Netlify and Cloudflare Pages, the Vercel equivalent, and when NOT to use it.

## Symptom
Your Lovable, Bolt or Cursor app (React + Vite + React Router) deploys fine and the home page loads. But when you refresh on `/dashboard`, or someone opens a shared link to it, they get Netlify's **"Page Not Found"** or Vercel's **"404: NOT_FOUND"**.

## Why it happens
- **Your app is a single-page app (SPA).** The only real HTML file is `index.html`; pages like `/dashboard` exist only inside your JavaScript.
- **Clicking a link works** because React swaps the page without asking the server.
- **A refresh asks the server for a file called `/dashboard`,** which doesn't exist, so the server returns 404.

## What we could not test
- Real Netlify or Vercel deploys (no accounts).
- `vercel.json` rewrites, because `vercel dev` needs a login.
- Cloudflare Pages, GitHub Pages and Azure.

## Full fix (paid)
The step-by-step fix, commands and test record are paid content and are not in this file. Price: $4 per fix (planned launch price; checkout not open yet). SHA-256 of the full fix: 03c45d60dc667da8068fed1428fd49735b6c178e16f5724c5a6fa0e4ca56135b. How to buy: https://stucktoshipped.com/pricing/ and https://stucktoshipped.com/products.json

## Sources
- [Stack Overflow: Netlify renders 404 on page refresh](https://stackoverflow.com/questions/58065603/netlify-renders-404-on-page-refresh-using-react-and-react-router)
- [Stack Overflow: Page Not Found ... deployed on Netlify](https://stackoverflow.com/questions/50752350/page-not-found-when-trying-to-access-a-site-deployed-on-netlify)
- [Stack Overflow: Vercel project 404 on refresh](https://stackoverflow.com/questions/75963788/why-is-my-vercel-project-giving-me-an-error-404-on-refresh)
- [r/lovable: Lovable website shows Page Not Found on Netlify](https://www.reddit.com/r/lovable/comments/1k10ug7/fix_lovable_website_shows_page_not_found_on/)
- [Netlify docs: redirects (file goes in the publish directory)](https://docs.netlify.com/manage/routing/redirects/overview/)
- [Netlify support guide: I've deployed my site but I still see Page not found](https://answers.netlify.com/t/support-guide-i-ve-deployed-my-site-but-i-still-see-page-not-found/125)

## How this page was made
Drafted by an AI agent and reproduced on our test machine on 2026-10-26. No warranty; test on a copy first.
