虚拟目录的根目录是localhost,而不是localhost / myapp。所以我的所有链接都被打破了

时间:2016-08-11 01:56:13

标签: iis

所以我在我的本地开发机器上部署了一个网站。我在Default Web Site中创建了一个应用程序。我可以使用localhost / myapp命中它并加载index.html。但是,index.html上的所有链接(css,js等)都在调用localhost / whatever.css。它正在切断/ myapp位。我需要添加到web.config吗? 仅供我,我正在运行Win10。使用VS2015创建的站点。 ASPNet5应用程序。

1 个答案:

答案 0 :(得分:0)

在index.html文件中,您可以使用以whatever.css开头的绝对路径链接这些/文件 - 正斜杠,例如/whatever.css

<link rel="stylesheet" href="/whatever.css">

删除那些正斜杠,使其看起来像whatever.css

<link rel="stylesheet" href="whatever.css">

这将解决错误。

相关问题