Cha*_*tem 2 javascript frontend firebase firebase-hosting
所以,让我们说在Firebase的公共文件夹中,我有一个index.html
和一个salon.html
.
现在对于xyz.com/salon/43
我想要加载的URL salon.html
和在javascript中我想从实时数据库中获取沙龙43.
现在我能够拥有像你这样的网址xyz.com/salon?id=43
.我想知道是否有可能在Firebase托管中做前者,如果是这样的话.
Fra*_*len 10
您正在寻找Firebase Hosting 重写.从文档:
如果要为多个URL显示相同的内容,请使用重写.重写对于模式匹配特别有用,因为您可以接受与模式匹配的任何URL,并让客户端代码决定要显示的内容.重写规则可用于支持使用HTML5 pushState进行导航的应用程序.当浏览器尝试打开指定的源URL时,将在目标URL处为其提供该文件的内容.
可以通过
rewrites
在firebase.json
文件中的托管中定义部分来指定URL重写:Run Code Online (Sandbox Code Playgroud)"hosting": { // Add the "rewrites" section within "hosting" "rewrites": [ { "source": "**", "destination": "/index.html" } ] }
归档时间: |
|
查看次数: |
3849 次 |
最近记录: |