firebase主机url重写模式匹配

firebase主机url重写模式匹配,firebase,firebase-hosting,Firebase,Firebase Hosting,如何重写URL,如: http://somedomain.com/page.html 到 http://somedomain.com/DIRECTORY/page.html 在firebase托管中。我在firebase.json中尝试了这个,但没有成功 "rewrites": [ { "source": "/**.html", "destination": "/DIRECTORY/**.html" } ] 模式匹配在firebase主机配置中是如何工作的。

如何重写URL,如:

http://somedomain.com/page.html

http://somedomain.com/DIRECTORY/page.html

在firebase托管中。我在
firebase.json
中尝试了这个,但没有成功

  "rewrites": [ {
      "source": "/**.html",
      "destination": "/DIRECTORY/**.html"
    } ]
模式匹配在firebase主机配置中是如何工作的。非常感谢您的帮助。

来自:

“重写”属性包含重写规则数组,其中每个规则必须包括:

  • A
    源代码
    指定

  • 一个
    目标
    ,它是一个必须存在的本地文件

因此,看起来您只能重写到特定的现有文件,而不能重写到另一个通配符

你可以考虑使用重定向,因为那些支持。


这会将重定向指令发送回客户机,以便他们能够看到最终路径。

我之前看到过它,但无法准确地确定它在我的情况下如何工作。我试了一下,找到了我问题中发布的配置,但它不起作用。你能为我的问题(有问题)发布模式吗?哦!我现在明白了。
"redirects": [ {
  "source": "/:page*",
  "destination": "http://somedomain.com/DIRECTORY/:page",
  "type": 301
}]