I am developing a web app and hosted all files on Firebase Hosting.
As of now my page URL looks like
mydomain.com/user/index.html?user=username
but when I enter
mydomain.com/username
It should behave same. What should be the rules?
I tried this but not working
{
"hosting": {
"public": "psNew4",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [ {
"source": "/user/index.html?user=:username", // username is dynamic
"destination": "https://example.com/:username",
"type": 301
}]
}
}
PS: username
is dynamic
Is there any solution for this or not?
According to the Firebase documentation on capturing URL segments for redirects you're looking for something like this:
"hosting": {
// ...
"redirects": [ {
"source": "/user/index.html?user=:username",
"destination": "https://example.com/:username",
"type": 301
}]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.