Firebase:使用URL变量进行URL重写/重定向

编程入门 行业动态 更新时间:2024-10-23 17:28:37
本文介绍了Firebase:使用URL变量进行URL重写/重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想访问Firebase托管网站上的example/folder/value1/value2/,并从example/folder/index.html加载内容?var1 = value1&2 = value2,同时保留新网址(不重定向到其中包含变量的.html页面.

I want to access example/folder/value1/value2/ on a Firebase hosted website and load content from example/folder/index.html?var1=value1&var2=value2 while keeping the new URLs (not redirecting to the .html page with variables in it).

我尝试了以下操作,但它返回404错误:

I have tried the following but it returns a 404 error:

rewrites": [ { "source": "/folder/:value1*/:value2*/", "destination": "/folder/index.html?var1=:value1&var2=:value2" }

有什么想法可以在Firebase中实现吗?类似于htaccess重写吗?

Any ideas if this is possible in Firebase? Similar to htaccess rewrites?

推荐答案

Firebase Hosting仅重写文件路径,而不重写查询参数.不可能在重写中使用捕获(仅在重定向中使用),并且目标必须是部署的静态文件的确切路径.

Firebase Hosting rewrites only rewrite the file path, not query parameters. It is not possible to use captures in rewrites (only in redirects), and the destination must be an exact path to a deployed static file.

更多推荐

Firebase:使用URL变量进行URL重写/重定向

本文发布于:2023-11-01 20:24:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550322.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   变量   重定向   Firebase   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!