该选项只是在firebase.json
文件中设置一个标志,将所有URL重定向到/index.html
。
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
有关更多信息,请参阅documentation of Firebase Hosting。
完整示例:
{
"hosting": {
"public": ".",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
去年我们曾经使用过这个选项(第一季度和第二季度),但它似乎什么也没做,但是现在我们应用它时,肯定会有很大的不同。这里有完整的官方解释:
https://firebase.google.com/docs/hosting/url-redirects-rewrites#section-rewrites
在同一页面的下一部分中甚至还有一些关于标题使用的有用信息。
注意:如果您想要服务器端渲染(SSR),请键入No并设置您的rewrites
如下:
"rewrites": [
{
"function": "angularUniversalFunction",
"source": "**"
}
]
毕竟,无论你选择什么,你总是可以在firebase.json文件中更改它。