Reputation: 7004
I have two workspaces:
main
blog
Using the Quickstart Guide, I have managed to succesfully deploy the main
workspace to mycustomdomain.firebaseapp.com
.
My firebase.json
looks as follows:
{
"firebase": "mycustomdomain",
"public": "/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
}
Note that I use the rewrite to handle clean urls as I am hosting an Angular 1.x website.
Now, I want to upload the content of the blog
workspace to the domain mycustomdomain.firebaseapp.com/blog
. How can I achieve this?
Upvotes: 2
Views: 409
Reputation: 599001
One way:
"rewrites": [{
"source": "/blog/**",
"destination": "/blog.html"
}, {
"source": "**",
"destination": "/index.html"
}]
So any request where the path starts with /blog/
will be handled by /blog.html
, everything else will be handled by index.html
.
With this:
https://mycustomdomain.firebaseapp.com/
-> index.html
https://mycustomdomain.firebaseapp.com/blog/
-> blog.html
Note that trailing slash in the last URL. Without that, the request would still be served by index.html
. If you don't want that, change the the first rewrite to "source": "/blog**"
This all boils down to glob pattern matching that Firebase Hosting uses to map the path to a destination. Use an online tester to play with them, if you've never done much with them. I just used http://www.globtester.com/ for that.
Upvotes: 2