问题描述
我在IIS上创建了一个名为SA的虚拟目录,如果键入Localhost / SA或Localhost / Sa /,一切正常,但如果我输入的URL Caseinsensitive就像这样Localhost / Sa在末尾路由没有斜线失败返回任何页面。
- 如果我禁用了html5mode,它会收到找不到404页面页面。
$ locationProvider.html5Mode(false);
我尝试了什么:
- 这是我使用的解决方法:
I created virtual directory on IIS called SA and if typed "Localhost/SA" or "Localhost/Sa/" everything working fine but if i typed the URL Caseinsensitive like this "Localhost/Sa" without slash in the end routes failed to return any page.
- if i disabled html5mode, it's getting "404 page not found" page.
$locationProvider.html5Mode(false);
What I have tried:
- Here's the workarounds that i used :
$urlMatcherFactory.caseInsensitive(true);
$urlMatcherFactory.strictMode(true); // or off nothing is work
$urlRouterProvider.rule(function ($injector, $location) {
var path = $location.path(), normalized = path;//.toLowerCase();
template = path;
if (path !== normalized) {
$location.replace().path(normalized);
}
}
});
- 尝试通过添加$ urlRouterProvider.rule将/连接到URL的末尾,但它也不起作用,并且无法连接 /到角度引导之前的URL的末尾。
我完成了这个问题请帮忙。
- tried to concatenate "/" to the end of the URL by adding $urlRouterProvider.rule but it's not working also, and couldn't concatenate "/" to the end of the URL before angular bootstrap.
I am done with this issue please help.
推荐答案
这篇关于如果它不区分大小写,则Angular路径总是需要斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!