Firebase:使用URL变量进行URL重写/重定向 [英] Firebase: URL Rewrites/Redirect with URL Variables

查看:91
本文介绍了Firebase:使用URL变量进行URL重写/重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to access example.com/folder/value1/value2/ on a Firebase hosted website and load content from example.com/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重写/重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆