sai*_*web 4 firebase firebase-hosting
我如何重写网址,如:
http://somedomain.com/page.html
到
http://somedomain.com/DIRECTORY/page.html
在 Firebase 托管中。我试过这个,firebase.json
但没有用。
"rewrites": [ {
"source": "/**.html",
"destination": "/DIRECTORY/**.html"
} ]
Run Code Online (Sandbox Code Playgroud)
模式匹配如何在 Firebase 托管配置中工作。帮助将不胜感激。
rewrites 属性包含一组重写规则,其中每个规则必须包括:
A
source
指定glob 模式A
destination
,这是一个必须存在的本地文件
所以看起来你只能重写一个特定的现有文件,而不是另一个通配符。
您可以考虑改用重定向,因为它们确实支持目标 URL 中的动态段。
"redirects": [ {
"source": "/:page*",
"destination": "http://somedomain.com/DIRECTORY/:page",
"type": 301
}]
Run Code Online (Sandbox Code Playgroud)
这会将重定向指令发送回客户端,因此他们将能够看到最终路径是什么。
归档时间: |
|
查看次数: |
2342 次 |
最近记录: |