I am building an angular site and using UI-Router, if I click a link to go to a route it works fine but whenever I refresh the page, or if I type the url in manually I get 'Cannot GET /find-a-vendor. I have this in my routes file:
我正在构建一个角度站点并使用UI-Router,如果我点击一个链接去一个路线它工作正常但每当我刷新页面,或者如果我手动输入网址我得到'无法获取/找到 - 一个供应商。我在我的路线文件中有这个:
$stateProvider
.state('home', {
url: '/',
templateUrl: 'views/home.html'
})
.state('find', {
url: '/find-a-vendor',
templateUrl: 'views/find.html'
})
I also have $locationProvider.html5Mode(true);
in my routes file as well. and in my index I have <base href="/">
in the header, is there something I'm missing?
我也有$ locationProvider.html5Mode(true);在我的路线文件中也是如此。在我的索引中,我在标题中有
1 个解决方案
#1
4
I've had this issue before and found this article that helped me tremendously. You need to do some server side rewrites.
我以前遇到过这个问题,发现这篇文章对我有很大的帮助。你需要做一些服务器端重写。
#1
4
I've had this issue before and found this article that helped me tremendously. You need to do some server side rewrites.
我以前遇到过这个问题,发现这篇文章对我有很大的帮助。你需要做一些服务器端重写。