I am trying to host a website at Google Firebase.
The index.html
is shown as (e.x.)app.firebase.com
, but when I want to access a page like login.html I need to type app.firebase.com/login.html
, just app.fire-base.com/login
doesn't work.
How would I achieve this for every .html
file in the directory (public), do I need to configure the firebase.json
? I read the docs but I could not find any information.
Here is my .json
{
"hosting": {
"public": "public",
"signin": "/signin.html"
}
}
Scroll down in 'Manage Site' and create a new site, then deploy there. You can't change your domain, but you can change the host! You can make as many sites as you want.
Pair Cloud Functions with Firebase Hosting to generate and serve your dynamic content or build REST APIs as microservices. Cloud Functions for Firebase lets you automatically run backend code in response to HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment.
To omit the .html
for all resource paths e.g. /login.html -> /login
"cleanUrls": true
to your .json
.firebase automatically redirects with a 301
code if user enters /login.html
.
"hosting": {
// ...
// Add the "cleanUrls" attribute within "hosting"
"cleanUrls": true
}
Read Control .html
extensions to know more.
For specific routing:
You can make a redirect/rewrite section in your .json
as described in the following,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With