How to implement this .htaccess in firebase?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 07:32:27

问题


I have this .htaccess for a PWA

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

I want to migrate the app to firebase, basically what it does is let's say I shared this link

example.com/pwa/giftLink

He gets redirected to PWA

example.com/pwa

And the PWA redirects him to giftLink. I don't want to do it via code, I prefer doing it via firebase.json


回答1:


In Firebase Hosting rewrites, the equivalent would be:

"hosting": {
  // ...

  // Add the "rewrites" attribute within "hosting"
  "rewrites": [ {
    "source": "/pwa{,/**}",
    "destination": "/pwa/index.html"
  } ]
}


来源:https://stackoverflow.com/questions/60260927/how-to-implement-this-htaccess-in-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!