I’m facing an issue with the URLs on my website. The website consists of multiple pages, all of which are .html files. The problem arises when I deploy the website on Firebase Hosting with a custom domain. The pages end up with custom URLs like this:
www.customdomain.com/page1.html (for example)
However, what I actually need is:
www.customdomain.com/page1 (without the ".html" extension)
This issue occurs on every page except the home page, where the URL is simply www.customdomain.com.
I’ve been referencing the other pages using HTML like this:
<a href="page1.html" class="link-1">Click to go to page 1</a>
Is there a way to remove the ".html" from each URL on the website? It may not necessarily be related to Firebase Hosting; it could be a problem with the references.
Thanks!
2
Answers
As per your explanation your site is static pages of .html pages and when you run your website at that time it will load with default page call index.html that’s why it not showing to you any file name. when ever you make any static site then it will display extension of file when it browse it’s default behavior.
For static files on Firebase Hosting, you can control
.html
extensions via thecleanUrls
in thefirebase.json
file configuration file.There’s no need to upgrade to a dynamic website to get rid of the filename extensions.
Also see: