问题描述
从
我正在使用Visual Studio 2015.
将< base href ="/anotherlevel"/>
更改为< base href ="/anotherlevel/"/>
.
请参见使用基本标记时的相对URL斜线.
> base
标记上的 href
属性需要一个斜杠.如果没有结尾斜杠,浏览器将把尾随路径元素视为文件而不是目录.这意味着请求仍将在根URI上下文中进行.
Moving from http://basedomaintohttp://basedomain/anotherlevel/
Everything breaks because it's still looking in http://basedomain. I tried changing <base href="/" />
to <base href="/anotherlevel" />
and <base href="http://basedomain/anotherlevel" />
but it had no effect. I'm still getting this:
I'm using Visual Studio 2015.
Change <base href="/anotherlevel" />
to <base href="/anotherlevel/" />
.
See Relative URL slash when using base tag.
The href
attribute on the base
tag requires a trailing slash. Without a trailing slash, the browser will treat the trailing path element as if it were a file rather than a directory. This means that requests will still be made in the root URI context.
这篇关于更改发布网址时,我所有的链接都被破坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!