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?
Make sure that you've completed the "Get Started" wizard from your project's Firebase Hosting pageso that you have a Firebase Hosting site in your Firebase project. Step 1: Add domain From your project's Hosting page, enter the wizard for connecting a custom domain: If you have only one Hosting site, click Connect domain.
Needs Re-Verification Firebase may require you to manually re-verify your domain ownership if any of the following situations happen: The TXT record added when you initially verified your domain ownershipwas altered or removed from your domain's DNS settings.
Firebase Hosting only applies a rewrite rule if a file or directory does not exist at a URL path that matches the specified source or regex URL pattern. When a request triggers a rewrite rule, the browser returns the actual content of the specified destination file instead of an HTTP redirect.
If requested in the Connect Domainsetup wizard, verify your apex domain. These steps ensure that your domain is not already linked with a Firebase project and that you own the specified domain. In your domain provider's site, locate the DNS management page. Add and save a new record with the following inputs: Type: Add a TXT record.
As far as I can tell, this is now possible. I found this really good article/video while trying to find a solution: https://fireship.io/lessons/deploy-multiple-sites-to-firebase-hosting/
I have the same issue. I think rewrites only support directories not subdomains. The simple solution is to just create two different Firebase projects.
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