【问题标题】:Firebase hosting redirect to shebangFirebase 托管重定向到 shebang
【发布时间】:2020-08-14 15:45:21
【问题描述】:

我有一个托管在 firebase 上的 SPA,它使用哈希路由(例如,路由/url 是 mysite.com/#!/mypath)。

我正在尝试将 Firebase 托管配置为将请求从“mysite.com/mypath”重定向到“mysite.com/#!/mypath”,但没有运气。我试过了:

"rewrites": [
  {
    "source": "/:path*",
    "destination": "/index.html/#!/:path"
  }
]

和:

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

还有:

"rewrites": [
  {
    "source": "**",
    "destination": "/index.html"
  }
],
"redirects": [
  {
    "source": "/:path*",
    "destination": "/#!/:path",
    "type": 301
  }
]

这可能吗?路径也可以像“mysite.com/mypath1/part2”等。

【问题讨论】:

    标签: firebase redirect url-rewriting firebase-hosting


    【解决方案1】:

    Firebase 托管重定向捕获目前无法应用于查询参数或哈希。如果这是你想看到的,请file a feature request

    【讨论】:

      猜你喜欢
      • 2016-03-16
      • 2015-12-07
      • 2019-09-10
      • 2020-10-14
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      相关资源
      最近更新 更多