Skip to content

Firebase Hosting errorFirebase Hosting: “Page Not Found” after deploy or on refresh

Firebase Hosting shows its own Page Not Found screen when the folder you deployed has no file for the URL and no 404.html. The two usual causes are a public setting in firebase.json that points at the wrong folder, and a single-page app with no rewrite to index.html.

Short answer

Set "public" in firebase.json to the folder your build writes, such as dist or build/web, run the build, then deploy again. If the home page works but other routes fail on refresh, add a rewrite of "**" to "/index.html". If the screen says Site Not Found instead, the site or custom domain usually has no live deploy yet, or the domain isn’t connected.

Rather not fix it yourself? App Fix Ticket starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.

Why the page is not found, and the fix

  1. 01

    public points at the wrong folder

    “The public attribute specifies which directory to deploy to Firebase Hosting.” Firebase, Configure Hosting behavior

    firebase init sets public to a folder called public, but most build tools write elsewhere: dist for Vite, dist/<project> for Angular, build for Create React App, out for a Next.js static export, build/web for Flutter. Firebase deploys whatever that folder holds. If you left the default public folder, you may see Firebase’s welcome page instead of your app. If the folder is missing, the deploy fails with a public directory error. A folder without index.html gives Page Not Found.

    {
      "hosting": {
        "public": "dist",
        "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
      }
    }
  2. 02

    The build didn’t run before deploy

    firebase deploy uploads the folder as it is. Run the build first, check that index.html is in the folder, then deploy. In CI, run both steps in the same job.

    npm run build && ls dist/index.html && firebase deploy --only hosting
  3. 03

    Routes work by clicking but not on refresh

    “You can also use rewrites to support apps that use HTML5 pushState for navigation.” Firebase, Configure Hosting behavior

    React Router, Vue Router and Flutter web handle routes in the browser. A refresh asks Hosting for a file like /dashboard, which doesn’t exist. Add a rewrite that serves index.html for every path without a file.

    "rewrites": [
      { "source": "**", "destination": "/index.html" }
    ]
  4. 04

    Another rule matches first

    “Within each of the redirects and rewrites attributes, Hosting applies the redirect or rewrite defined by the first rule with a URL pattern that matches the requested path.” Firebase, Configure Hosting behavior

    Rules run top to bottom, and the first match wins. A broad rewrite above a function or API rewrite sends those requests to the wrong place. Put the specific rules first and the "**" rewrite last.

Checked against the vendor’s docs on : Firebase docs: Configure Hosting behavior.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
A buyer in the United States, July 2022. Shopify on Fiverr
All 127 Fiverr reviews

Related: “Page Not Found” on refresh on Netlify or Vercel · Firebase Cloud Functions CORS error · Firebase Storage unauthorized · Firebase Storage object-not-found

Questions

More on this error

Can I show my own 404 page?

Yes. Put a 404.html at the root of the deployed folder and Hosting shows it for missing pages. A single-page app with the "**" rewrite rarely reaches it, so handle unknown routes in the app too.

What does Site Not Found mean?

It is a different screen. It usually means the site or custom domain has no live deploy yet, or the domain isn’t connected. Check firebase use and the site name in firebase.json, then deploy again.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.