Search code examples
firebasehttp-redirecturl-rewritingfirebase-hosting

Firebase hosting redirect to shebang


I have an SPA hosted on firebase, that uses hash routing (e.g. routes/urls are mysite.com/#!/mypath).

I'm trying to configure firebase hosting to redirect requests from "mysite.com/mypath" to "mysite.com/#!/mypath" but am having no luck. I've tried:

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

and:

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

and also:

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

Is this possible to do? Paths can also be like "mysite.com/mypath1/part2", etc.


Solution

  • Firebase Hosting redirect captures cannot currently be applied to query parameters or hashes. If this is something you'd like to see, please file a feature request!