简体   繁体   中英

How to map the default document in iis residing inner folder

在此输入图像描述

How can I map the default document file from Dir2 folder. There I have a index.html file. While I configure as

在此输入图像描述

the js file and css files are not working with this index.html page. How can I solve this issue?

This doesn't sound like it has anything to do with IIS or default documents and everything to do with how you included your references to your style and script files in your HTML pages. You'll need to make sure the URLs are correct in each page. If you try to browse to the JS or CSS file using the URLs you specified in Ap1/index.html, what happens? If you get a 404 then your src or href attributes are incorrect in that file.

Based on your comments, if you're looking to use the exact same page at different levels of your application, you'll need to convert the paths to your JavaScript and CSS files to absolute paths. An absolute path starts with a forward slash "/" and progresses from the root of your site hierarchy until it reaches your file. For example, if you had your script files at a folder just below the root level you'd do the following:

<script type="text/javascript" src="/scripts/myscript.js"></javascript>

Likewise for a style in a folder below the root level you'd do the following:

<link rel="stylesheet" href="/styles/mystyle.css" />

The client browser should then be able to find your files no matter where in your site hierarchy you've placed your index.html.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM