2017-03-31 58 views
3

背景

我有一个结构化的这样一个网站:火力地堡改写单页VueJS应用程序中的子文件夹

root 
    — /public 
    — index.html <— landing page 
    — 404.html 
    — /library 
     — index.html <— single page VueJS app 

单页的应用程序可以在这里找到:https://uxtools-3ac6e.firebaseapp.com/library/

这里是我的火力点.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而不是library/index.html。

回答

8

您需要使用双星水珠匹配:

"source": "/library/**" 

单星将只匹配到一个斜线,所以它会匹配/library/lists但不/library/lists/foo

+0

谢谢,先生。如果其他人面临这个问题,重写也改变了我的JavaScript和图像的亲属路径。绝对路径解决了这个问题。 – taylorpalmer