blog

Netlify "Page Not Found" After Deploy: How to Fix It

Netlify says "Looks like you've followed a broken link" right after a deploy? Check 4 things: publish directory, build, index.html, SPA redirects.

5 min readNetlifyBoltFixes

Netlify says your deploy succeeded. You open the site and get Netlify's own error page instead of your app. It's frustrating — especially when the app worked fine in Bolt or on your computer.

The good news: this page has only a handful of causes, and Netlify lets you see exactly which files went live, so you don't have to guess. This guide follows Netlify's own troubleshooting guide, with real cases from Netlify's forum.

What you see

Netlify's page not found error guide shows the exact message:

Page not found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.

This page comes from Netlify, not from your app. It means Netlify couldn't find a file for the address you requested — and as a Netlify community member put it in one thread, you wouldn't see this message if the file existed.

Whole site or only some pages?

The first question tells you which fix you need:

  • The home page shows "Page not found". Netlify has no index.html to serve at the root of your site. Either the publish directory is wrong, or the app was never built, so there's no index.html where Netlify looks. → Fix 1 or Fix 2.
  • The home page works, but other pages show "Page not found" when you refresh them or open a link to them directly. Your app is a single-page app, and Netlify needs a rewrite rule to send those addresses to index.html. → Fix 3.
  • The page loads, but it's blank, with a "Failed to load module script" error in the console. That's a different problem: see "Expected a JavaScript module script" error.

See what was actually deployed

Before you change any settings, look at the files Netlify really published. Netlify's guide describes how:

  1. From your project overview, choose Deploys in the left sidebar.
  2. Select your latest published production deploy — the one your live site uses.
  3. Under the deploy summary and deploy log, open the Deploy File Explorer and look at the file structure.

What a working Vite or Bolt app looks like:

index.html
assets/
  index-abc123.js
  index-def456.css

What you may see instead:

  • A folder (like dist/ or my-project/) with index.html inside it, but nothing at the top level → the publish directory is wrong (Fix 1).
  • src/, package.json, vite.config.ts → the source code was deployed without a build (Fix 2).
  • No files at all, or no .js files → the build didn't produce output; check the deploy log for errors.

Fix 1: Set the publish directory

The publish directory is the folder Netlify serves. Netlify's guide says it must be set in your project settings and contain an index.html.

  1. In Netlify, go to Project configuration → Build settings.
  2. Choose Configure and enter your publish directory. For apps built with Vite (which includes most Bolt and Lovable projects), that's dist: Vite's build.outDir option defaults to dist.
  3. Confirm your changes and deploy again: push a new commit if the site is connected to Git, or, for a site without Git, drag the built folder to the dropzone at the bottom of the site's Deploys page.

If your site has continuous deployment from Git, Netlify's build configuration docs place these fields under Project configuration → Developer settings → Continuous deployment → Build settings. You can also set them in a netlify.toml file in the root of your repository:

[build]
  command = "npm run build"
  publish = "dist"

Settings in the file override the ones in the UI.

Netlify's support guide on page not found errors mentions a related case: files that live in a sub-folder of the repository while the publish directory points to the root. Then the site only works at your-site.netlify.app/sub-folder. Either move the files or change the publish directory.

Fix 2: You deployed source files without a build

If the Deploy File Explorer shows src/, package.json and similar, Netlify published your project's source code instead of the built app. In the forum thread about a Bolt site with this error, the community member's diagnosis was the same: "Not running a build and accidentally deploying source files" is one of the most common reasons.

The fix is to deploy the output of npm run build (the dist folder), or to let Netlify build from your Git repository with build command npm run build and publish directory dist. Both are explained step by step in "Expected a JavaScript module script" error: how to fix it.

Fix 3: Add the SPA redirect

Apps made with Vite and React are single-page apps: one index.html, and JavaScript decides what to show for /dashboard or /settings. Clicking links inside the app works, but when you refresh or open /dashboard directly, Netlify looks for a file at that path, finds none, and shows "Page not found".

Netlify's guide says single-page apps may need a redirect rule in a _redirects file so all routes are handled by the app. In Netlify's rewrites documentation, this rule serves index.html instead of a 404 no matter which URL the browser requests, and it's typically the last rule if you have others.

  1. In your project, open (or create) the folder public in the project root — next to package.json.
  2. Create a file named exactly _redirects (no extension) inside it.
  3. Put this line in it:
/*    /index.html   200
  1. Commit and deploy again.
  2. Open an inner page directly, for example https://your-site.netlify.app/dashboard, in a private window and refresh. You should see your app.

Why public/? Vite's assets guide says files in the public directory are copied to the root of the dist directory as-is. So public/_redirects ends up as dist/_redirects, right where Netlify looks for it. A _redirects file in the project root would not be copied into dist.

If you prefer netlify.toml, Netlify's rewrites docs show the same rule like this:

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

Real files (your JavaScript, CSS and images) are still served normally; only addresses without a file go to index.html. The same problem on Vercel has its own one-file fix: see Vercel 404 NOT_FOUND on page refresh.

Other frameworks (Astro and others)

Not every app is a Vite single-page app, and the SPA rule isn't always right. In the forum thread mentioned above, the site was built with Bolt and Astro, and the home page itself showed "Page not found" — meaning there was no index.html at the root of the deploy.

For frameworks like Astro, Next.js, Nuxt, SvelteKit or Remix, Netlify's support guide notes that server-side rendering works through framework integrations, and recommends checking the integration's docs if routing doesn't work. In practice:

  1. Find Netlify's guide for your framework in Netlify's docs (they have a frameworks section).
  2. Use the build command and publish directory it gives, instead of dist.
  3. Check the Deploy File Explorer again after the next deploy.

If Bolt generated a configuration that keeps failing, the forum thread also suggests reporting it to Bolt's support, since the project setup comes from Bolt.

Finally, if everything looks right and the site still fails, check whether Netlify is having an incident on our Netlify status page. For other problems after deploying from Bolt — environment variables, sign-in, payments — see Why is my Bolt.new app not working after deploy.

FAQ

Why does Netlify show "Page not found" when my deploy succeeded?
A successful deploy only means files were uploaded. Netlify shows this page when no file exists at the address you opened. For the home page, that usually means there's no index.html in the publish directory, because the directory is wrong or the app wasn't built.
The home page works but other pages show Page not found after refresh. Why?
Your app is a single-page app: every page is drawn by JavaScript from one index.html. Netlify looks for a real file at /dashboard, finds none, and shows the 404. Add the rewrite /* /index.html 200 in a _redirects file.
Where do I put the _redirects file in a Vite project?
In the public folder at the root of your project. Vite copies everything in public into the dist folder as-is when it builds, so the file ends up in your publish directory.
What publish directory should I use for a Vite or Bolt app?
dist, which is where Vite puts the build by default. For other frameworks, check Netlify's guide for that framework.

Fixed it? Run a free Pingbuddy checkup on your live site. It shows whether your site answers and how fast, when your SSL certificate and domain expire, whether your Supabase project is paused and whether secret keys are visible in your public code.

Run free checkup →