[英]Firebase rewrites in single page VueJS app in subfolder
I have a site that is structured like this: 我有一个结构如下的网站:
root
— /public
— index.html <— landing page
— 404.html
— /library
— index.html <— single page VueJS app
The single page app is found here: https://uxtools-3ac6e.firebaseapp.com/library/ 单页应用程序可在此处找到: https : //uxtools-3ac6e.firebaseapp.com/library/
Here's my firebase.json: 这是我的firebase.json:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/library/*",
"destination": "/library/index.html"
}
]
}
}
When the app begins to route to sub paths, like https://uxtools-3ac6e.firebaseapp.com/library/lists/order-group-best-sources-learn-ux , a refresh will redirect to 404 instead of library/index.html. 当应用程序开始路由到子路径时,例如https://uxtools-3ac6e.firebaseapp.com/library/lists/order-group-best-sources-learn-ux ,刷新将重定向到404而不是库/索引html的。
You need to use a double-star glob to match: 你需要使用双星形的glob来匹配:
"source": "/library/**"
The single-star will only match up to a slash, so it would match /library/lists
but not /library/lists/foo
. 单星将只匹配斜杠,因此匹配
/library/lists
而不匹配/library/lists/foo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.