Firebase托管重定向到shebang

时间:2020-08-14 15:45:21

标签: firebase redirect url-rewriting firebase-hosting

我在Firebase上托管了一个SPA,该SPA使用哈希路由(例如,路由/网址为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”等。

1 个答案:

答案 0 :(得分:1)

Firebase Hosting重定向捕获当前无法应用于查询参数或哈希。如果您希望看到此内容,请file a feature request