2016-01-02 33 views
2

我有两个工作区:火力地堡托管部署两个工作区

main 
blog 

使用Quickstart Guide,我已成功地在main工作区成功地部署到mycustomdomain.firebaseapp.com

firebase.json如下所示:

{ 
    "firebase": "mycustomdomain", 
    "public": "/", 
    "ignore": [ 
    "firebase.json", 
    "**/.*", 
    "**/node_modules/**" 
    ], 
    "rewrites": [ { 
    "source": "**", 
    "destination": "/index.html" 
    } ] 
} 

请注意,我用的是重写处理干净的网址,因为我举办一个角1.x的网站。

现在,我想将blog工作区的内容上载到域mycustomdomain.firebaseapp.com/blog。我怎样才能做到这一点?

回答

2

方式一:

"rewrites": [{ 
    "source": "/blog/**", 
    "destination": "/blog.html" 
}, { 
    "source": "**", 
    "destination": "/index.html" 
}] 

那么,路径与/blog/开头的请求将被/blog.html处理,其他的一切都会被index.html处理。

有了这个:

  • https://mycustomdomain.firebaseapp.com/ - >index.html
  • https://mycustomdomain.firebaseapp.com/blog/ - >blog.html

注意的是,在最后的URL斜线。没有这一点,请求将仍然由index.html服务。如果你不想要的话,改变第一次重写为"source": "/blog**"

这全归结为glob pattern matching that Firebase Hosting uses将路径映射到目的地。如果你从来没有用过很多东西,可以使用在线测试器和他们一起玩。我刚刚使用了http://www.globtester.com/