The short answer
Firebase Hosting serves files by exact name. Without configuration, /about does not resolve to about.html.
With cleanUrls enabled:
/aboutreadsabout.html;/about.html301-redirects to/about;trailingSlashcontrols 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.
publicpoints at source files instead of the built output.- Mixed-case file names.
- SPA rewrite added to a multi-page site.
Checklist
- [ ]
cleanUrls: true - [ ]
index.htmlinsidepublic - [ ] Internal links and canonicals are extensionless
- [ ] No SPA rewrite for a multi-page site
- [ ]
404.htmlpresent
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 TeamContent 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