2

I have a website at http://myserver/project1.

'myserver' is a Windows Server 2003 server with IIS6.

'project1' is a virtual directory (the physical path of which is C:\myprojects\project1.

I have read that the best way to link to an external stylesheet (for example) is to use a forward slash, e.g. <link href="/style.css">, as I would also like to link to this stylesheet from a subfolder of the virtual directory.

I would expect this to look for the css file in http://myserver/project1/, but it seems to be looking in http://myserver/. I know this because typing <link href="/project1/style.css"> works.

I am guessing it's normal for http://myserver/ to be considered the 'website root' as this is the 'Default Website' (in IIS terms). What I would like to know is if there a way to (either via IIS or PHP) to change this so that I can write paths in the format /style.css and have the virtual directory find them.

Many thanks

valoukh
  • 541
  • 1
  • 8
  • 19

1 Answers1

0

If I am understanding you, on non Windows systems I think I would approach this with a symbolic link or simply checking out the common directories for each domain. You can't use a relative link path like you show to include across a domain. File system path vs your server URI is apples and oranges. Maybe take a look at Mklink. This post might also be helpful.

Now more I think about this doesn't IIS6 just provide a simple way in the GUI to add (maybe they call them virtual directories?) multiple folders into the domain. This SO post might be pretty close to your question: How do I resolve absolute URLs for different sites in the same parent IIS virtual directory in .NET?

Community
  • 1
  • 1
ficuscr
  • 6,975
  • 2
  • 32
  • 52
  • 1
    Yes, I am using a Virtual Directory. The issue is that the browser doesn't see the virtual directory as the root of the site when looking for files/folders. – valoukh Nov 01 '13 at 15:51