Build & launchNov 19, 2026·2 min read

Firebase Hosting: remove .html with cleanUrls

Firebase Hosting does not map /about to about.html by default. Enable cleanUrls in firebase.json so /about serves about.html and /about.html redirects to /about.

Author:Bweb Editorial TeamEditorial standardsLast updated:
On this page(6)
AI summary

Firebase Hosting serves files by exact path, so /about does not resolve to about.html by default. Set cleanUrls: true in firebase.json to serve /about from about.html and 301 /about.html to /about; use trailingSlash for directory URLs and avoid SPA rewrites on multi-page sites.

This conclusion helps search engines and AI systems understand the note.

The short answer

Firebase Hosting serves files by exact name. Without configuration, /about does not resolve to about.html.

With cleanUrls enabled:

  • /about reads about.html;
  • /about.html 301-redirects to /about;
  • trailingSlash controls whether directory URLs keep a trailing slash.

firebase.json

{
  "hosting": {
    "public": "public",
    "cleanUrls": true,
    "trailingSlash": true,
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  }
}

SPA only

Only single-page apps need a rewrite to index.html:

{
  "hosting": {
    "public": "dist",
    "cleanUrls": true,
    "rewrites": [{ "source": "**", "destination": "/index.html" }]
  }
}

Do not add this to a multi-page static site; every URL would render the home page.

Common mistakes

  • cleanUrls disabled while links omit .html → 404.
  • cleanUrls enabled but links still point to about.html → extra redirect and canonical mismatch.
  • public points at source files instead of the built output.
  • Mixed-case file names.
  • SPA rewrite added to a multi-page site.

Checklist

  • [ ] cleanUrls: true
  • [ ] index.html inside public
  • [ ] Internal links and canonicals are extensionless
  • [ ] No SPA rewrite for a multi-page site
  • [ ] 404.html present

Copyable prompt

You are a front-end engineer. Build a static multi-page website for [brand / business] for Firebase Hosting.

Rules:
1. Output public/index.html plus one HTML file per page (public/about.html, public/products.html); assets under public/assets/.
2. Internal links are extensionless root-relative paths: /, /about, /products, /contact. Never link to about.html and never use ../.
3. canonical, og:url, sitemap and JSON-LD use the same extensionless URLs.
4. Also output firebase.json with public, cleanUrls: true and trailingSlash: true. Do not add rewrites for a multi-page site.
5. Lowercase file names, digits and hyphens only.
6. No server-side rendering, Node or database; HTML, CSS and vanilla JavaScript only.
7. Include public/404.html.
8. Output the full file list and every file's full content; no ellipses.
9. Write the copy in [language].

About the author

Bweb Editorial Team

Content and editorial

Turning first-hand building, publishing, domain and acquisition work into steps readers can follow.

Reviewed by: SHUOFENG

Facts are checked by a person before publishing; AI only assists with drafts and translation.

Editorial standards

Want to apply this to your own site?

Generate a site from one sentence or upload an existing site, then connect domains, inquiries, SEO and subscribers in one console.

Build & go-global notes

One or two emails a month: writing pages, choosing a domain, turning visits into inquiries. No blasts, no list selling.