【问题标题】:Firebase hosting trailing slash for specific pathFirebase 托管特定路径的斜杠
【发布时间】:2020-05-25 11:22:36
【问题描述】:

我想将https://b6.games/solitaire 重定向到https://b6.games/solitaire/

我该怎么做? 我可以为特定路径设置斜杠吗?

注意:我使用的是cleanUrls:true,而https://b6.games/solitaire/ 确实是https://b6.games/solitaire/index.html

没有https://b6.games/solitaire.html 文件,但firebase 以某种方式路由到它。

【问题讨论】:

    标签: firebase firebase-hosting


    【解决方案1】:

    如果您使用 Firebase 托管,则需要更改您的 firebase.json 以包含此部分:

    "hosting": {
      // ...
    
      // Add the "trailingSlash" attribute within "hosting"
      // When true, Hosting redirects URLs to add a trailing slash.
      "trailingSlash": true
    }
    

    这里的文档:

    https://firebase.google.com/docs/hosting/full-config#control_trailing_slashes

    【讨论】:

      猜你喜欢
      • 2012-11-16
      • 1970-01-01
      • 2016-05-04
      • 2021-01-06
      • 2020-11-20
      • 2013-01-28
      • 2017-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多