MALIK ADEBAYO
MALIK ADEBAYO

Reputation: 23

How to set a default page to display in firebase

I just finish my app and deployed it to Firebase, however I'm getting error 404 that it cant find the home file, so I'll have to manually add /home.html at the back of the URL (https://website.web.app/home.html) before it display my app on the browser. Any idea on how to set a default page in the .json file Please. I used Bootstrap, html for the app.

Upvotes: 1

Views: 2315

Answers (2)

bart
bart

Reputation: 1

You can use redirects option from "firebase.json" config:

    {
        "hosting": {
            ...
            "redirects": [
                {
                    "source": "/index.html",
                    "destination": "/home.html",
                    "type": 301
                },
                {
                    "source": "/",
                    "destination": "/home.html",
                    "type": 301
                }
            ]
        }
    }

Upvotes: 0

Doug Stevenson
Doug Stevenson

Reputation: 317352

index.html is the default page for Firebase Hosting. According to the configuration documentation, there doesn't appear to be a way to change this. It's probably going to be easiest for you to simply use index.html instead of home.html.

You could also attempt to use a rewrite to change requests to home.html into a request for index.html, but I think it will be easier to just change the name of your file.

Upvotes: 1

Related Questions