Search code examples
firebase-hosting

Firebase rewrite based on subdomain


I've got a project hosted on firebase. I'd like to use a domain and subdomain as follows:

example.com: rewrite to index-landing.html
app.example.com: rewrite to index.html

Is that possible? I've tried the following under the hosting section of firebase.json:

"rewrites": [
  {
    "source": "https://example.com",
    "destination": "/index-landing.html"
  },
  {
    "source": "https://app.example.com/**",
    "destination": "/index.html"
  }
]

Any ideas?


Solution

  • I have the same issue. I think rewrites only support directories not subdomains. The simple solution is to just create two different Firebase projects.