【问题标题】:dropldown links not working after firebase hostingfirebase托管后下拉链接不起作用
【发布时间】:2018-12-21 17:30:16
【问题描述】:

我正在关注 Udemy 的角度教程。我可以在本地主机中打开引导导航栏下拉链接,但在托管到 firebase 后无法打开(其他导航栏链接按预期工作)。请帮忙

我遇到了 404 错误:

404 网页未找到 在此网站上找不到指定的文件。请检查 URL 是否有错误,然后重试。 为什么我会看到这个? 此页面由 Firebase 命令行界面生成。要修改它,请编辑项目配置的公共目录中的 404.html 文件。

index.html:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Oshop</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.ffb6f1d88864b80c037e.css"></head>
<body>
  <app-root></app-root>
<script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"></script><script type="text/javascript" src="polyfills.2f4a59095805af02bd79.js"></script><script type="text/javascript" src="main.10b7c76792e4769182f0.js"></script></body>
</html>

firebase.json:

{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

【问题讨论】:

    标签: angular firebase firebase-hosting


    【解决方案1】:

    我通过将我的 firebase.json 文件修改为以下内容来修复它:

    "rewrites": [{
          "source": "/public/**",
          "destination": "/public.html"
        },
        {
          "source": "**",
          "destination": "/index.html"
        }]
    

    【讨论】:

      猜你喜欢
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-31
      • 2020-05-19
      • 2015-06-10
      • 1970-01-01
      相关资源
      最近更新 更多