我的网站结构如下:
root
— /public
— index.html <— landing page
— 404.html
— /library
— index.html <— single page VueJS app
单页应用可在此处找到:https://uxtools-3ac6e.firebaseapp.com/library/
这是我的firebase.json:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/library/*",
"destination": "/library/index.html"
}
]
}
}
当应用开始路由到子路径时,例如https://uxtools-3ac6e.firebaseapp.com/library/lists/order-group-best-sources-learn-ux,刷新将重定向到404而不是库/ index.html。
答案 0 :(得分:8)
你需要使用双星球匹配:
"source": "/library/**"
单星只会匹配斜杠,因此匹配/library/lists
但不匹配/library/lists/foo
。