Firebase 托管 index.html 仅在 URL `/index.html` 中指定时显示,默认/主页“找不到网站”

问题描述 投票:0回答:2

在我的 firebase URL 中,当我转到 https://example.web.app 时,它显示来自 Firebase 的“找不到站点”。

但是如果我去 https://example.web.app/index.html,URL 会工作,它会显示

index.html
页面。

我如何让它指向默认页面 aka 主页,而不是我必须重定向到

index.html
页面?

firebase.json

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

dist/index.html
存在。
dist
目录用于
public
托管。

index.html
在我重定向到
https://example.web.app/index.html
时工作正常,但在我转到
https://example.web.app
时不起作用,我该如何解决?

URL只是一个“例子”,试图给大家解释一下。这不是实际网址。

html firebase firebase-hosting
2个回答
0
投票

最好的选择是联系 Firebase 客户支持并向他们寻求帮助。


0
投票

如果你检查 url https://your-website-name.firebaseapp.com,你会发现它有效但不是 https://your-website-name.web.app.

要解决这个问题,运行以下命令行代码: curl -X PURGE https://your-website-name.web.app.

我遇到了同样的问题,并得到了 Google 支持团队的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.