How to redirect from Firebase Hosting


firebase

Assume you have some site deployed to Firebase Hosting and want to add a temporary redirect from your app.

Solution

You have to add a redirects array to your firebase.json to hosting property.

Example

{
  "hosting": {
    "public": "dist",
    "redirects": [
      {
        "source": "/",
        "destination": "https://akhromieiev.com",
        "type": 301
      }
    ],
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  }
}
comments powered by Disqus