[thelist] Virtual directories in IIS

Chris Marsh chris at ecleanuk.com
Wed Jun 18 07:44:15 CDT 2003


David

> following on from an earlier post of mine. [pros/ cons of 
> using relative links] i am trying to configure IIS on a test 
> webserver to allow my links to work.
> 
> basically i have several websites running on my machine, and 
> i want links like /images/foo.png to work. even though the 
> image is physically located in 
> \inetpub\wwwroot\mytestsite\images\foo.png

Open the IIS manager. Find your default website, or if you have created
your own then find that website. Right click on it, and go to
properties. Now click on the "Home Directory" tab. In the field marked
"Local Path" you will see the physical path to the root of your web
server. In your case if this is c:\inetpub\wwwroot and your image is
located in c:\inetpub\wwwroot\mytestsite\images\foo.png then the URL for
the image is http://localhost/mytestsite/images/foo.png. If the document
containing the link to the images is in the root folder, then the
relative link to your image is mytestsite/images/foo.png. If the
document containing the link to the image is in the folder mytestsite,
then the relative link is images/foo.png. Your leading forward slash in
the example link given is telling the server that the link is NOT
relative, and that it lives in [server root]/images/... I think this is
probably your problem.

> from the previous posts, i am guessing this is done in apache 
> using virtual hosts, and i am trying to find the equivalent in IIS.
> 
> i have tried moving the mytestsite directory to a different 
> location and setting up a virtual directory in IIS, however 
> the image is not being displayed, and if i look at the 
> properties the webpage is expecting the image to be found in 
http://localhost/images/foo.png

[..]

HTH

Regards

Chris Marsh



More information about the thelist mailing list