本文介绍了更改发布网址时,我所有的链接都被破坏了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

这篇关于更改发布网址时,我所有的链接都被破坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 12:54