我有一个指向“项目详细信息”页面的 URL 结构,如下所示:(john/project/eRdKn6
其中“john”是用户名,“eRdKn6”是项目 ID)。我希望将其重写到文件project.html
中,在其中解析 document.location 并加载适当的数据。所以用户名和项目ID应该是动态的。
我的规则firebase.json
如下所示:
{
"source": "*/project/*",
"destination": "/project.html"
}
但是,当我尝试加载 Firebase 404 时http://example.com/john/project/eRdKn6
。
我试图只使最后一部分动态化,作为测试(例如{"source": "john/project/*", "destination": "/project.html"}
,但我也得到了 404.
project.html
是在文件public
夹中。
这是我的完整firebase.json
文件:
{
"firebase": "example",
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{"source": "*/project/*", "destination": "/project.html"}
]
}