Firebase无法从索引文件夹中提取索引文件

时间:2018-09-18 08:08:48

标签: firebase firebase-hosting

我在公共位置添加了2个文件夹

1-名为“ index”的文件夹包含index.html。

2-一个名为“ about”的文件夹包含index.html。

我已经将这2个文件夹托管在firebase上,但是firebase没有从index文件夹中选择index.html,但是如果我直接粘贴到root中,它将被选中,这是为什么呢?我还想补充一点,链接到“ about”文件夹时,只要我想从索引导航到about,它就会自动从about文件夹中选择index.html文件。

我想要实现

enter image description here

代替此

enter image description here

1 个答案:

答案 0 :(得分:2)

您应该使用一个或多个重写和/或重定向,请参见此处的文档:https://firebase.google.com/docs/hosting/url-redirects-rewrites

例如,以下$Assemblyfiles = Get-ChildItem -Path $SrcDir -Recurse -Include AssemblyInfo.cs | Where-Object { $_.FullName -ne "D:\Projects\Lambda\Sources\Lambda.XYZ\XYZCallStrategy\Properties\AssemblyInfo.cs" } 文件将起作用:

firebase.json

请注意,我们在上面的配置中使用的是名为{ "hosting": { "public": "public", "redirects": [ { "source" : "/contact", "destination" : "/contact/contact.html", "type" : 301 } ], "rewrites": [ { "source": "**", "destination": "/index/index.html" } ], "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } } 的文件夹,而不是“名为about的文件夹包含index.html”。