背景:Angular 4、ng cli、RouterModule、useHash:true。
当我使用 http://server/index.html
浏览到我的应用程序时,它解析为 http://server/#/
(省略了 index.html来自 url)此外,每个路由导航也会省略 url 中的 index.html。
这对于我的应用程序的托管方式来说是有问题的,我需要在网址中保留index.html。我如何配置 Angular 来保留它?
最佳答案
你可以尝试:
ng build --prod --base-href /app/index.html
但它可能会影响您 Assets 的相对路径。
关于Angular 2\4 哈希 url 保留index.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44615646/