该选项仅在firebase.json
文件中设置一个标志即可将所有URL重定向到/index.html
。
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
有关更多信息,请参阅Firebase Hosting文档,该文档还包含以下完整示例:
"hosting": { // ... // Add the "rewrites" attribute within "hosting" "rewrites": [ { // Serves index.html for requests to files or directories that do not exist "source": "**", "destination": "/index.html" }, { // Serves index.html for requests to both "/foo" and "/foo/**" // Using "/foo/**" only matches paths like "/foo/xyz", but not "/foo" "source": "/foo{,/**}", "destination": "/index.html" }, { // Excludes specified pathways from rewrites "source": "!/@(js|css)/**", "destination": "/index.html" } ] }
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句