• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question about IIS

Zucarita9000

Golden Member
Here's the deal:
I'm running Windows 2000 SP4 with IIS 5.0 for website development. I've several sites in the server, and now I'm working on a project that requires relative to site's root links. Now, the problem is that I don't know how to configure IIS to set a different root directory for each site, because whenever I set a img src to "/images/my_pic.jpg", IIS looks for it in C:\Inetpub\wwwroot\ (http://localhost/) instead of C:\Intepub\wwwroot\MySite\.

How do I configure a root for each site?

Thanks a lot for your help-
 
In the internet services manager console, highlight the site, right click, and open the properties dialog. You should see a tab named "Home Directory." That's where you set the root folder for a site.
 
It seems I only have that option when I select "Default website" and not when I right click on the different virtual directories I have...
 
Can I have a root directory for each virtual dir I create? It seems I can only have wwwroot as a root dir. I need to have multiple websites with their own root dir... how do I do this? Do I need Windows 2000 Server in order to be able to do this?

EDIT: I found this in another forum:

"The server version of IIS will allow you to set up multiple websites. The workstation version (W2K Pro/XP Pro) doesn't support multiple websites and you're stuck using "subwebs" for multiple sites."


Does this mean that I can only have one root dir (only a single website)? I believe so, am I wrong?
 
Originally posted by: Zucarita9000
Can I have a root directory for each virtual dir I create? It seems I can only have wwwroot as a root dir. I need to have multiple websites with their own root dir... how do I do this? Do I need Windows 2000 Server in order to be able to do this?

EDIT: I found this in another forum:

"The server version of IIS will allow you to set up multiple websites. The workstation version (W2K Pro/XP Pro) doesn't support multiple websites and you're stuck using "subwebs" for multiple sites."


Does this mean that I can only have one root dir (only a single website)? I believe so, am I wrong?

First of all, are you using Professional or Server? You meantioned a "server" in your first post, so I assumed you had 2000 Server. If not, and you are using Professional, then you
are limited to a single "web site." But let's be clear what this means. Suppose you are hosting three "sites" -- "site1", "site2", and "site3". With Professional, these will be accessed from browsers as:

www.mainwebsite.com/site1
www.mainwebsite.com/site2
www.mainwebsite.com/site3

However, there is no need for them to be run out of the wwwroot folder. They can be located anywere. That's the idea behind a "virtual directory." To the user, "site1" looks like a directory of "www.mainwebsite.com." But while wwwroot may be on drive c:, the "root directory" of "site1" can be anywhere, say "D:\websites\site1". To see this, just right click on "Default Website" and select "New Site". The wizard will prompt you for a directory; this will be the "root directory" of the site.

The limitation of this approach is that multiple web sites will have to be virtual directories of the main web site. What you can do with 2000 Server, that you cannot do with Professional, is create "virtual sites" (as opposed to "virtual directories"). This allows your sites to be accessed by unique domain names, like:

www.website1.com
www.website2.com
www.website3.com

all running off the same server with a single IP address.

If this webserver is running on a local lan, and will not be on the internet, you ought to be able to get by with "virtual directories." Of course, even on a lan, you could make use of virtual sites with a local DNS server.

Hope this helps. Keep asking until things are cleared up.
 
To clear things up, I'm running Windows 2000 Professional SP4.
The thing with virtual directories is that I can't define a root directory for them, it will always be the X:\ (X being the drive unit). Let's say I have my websites on D:\Websites. I have three different sites: "Site1" Site2" and "Site3". I create a virtual dir for each: http://localhost/Site1/ ... etc. Whenever I use absolute paths, the root dir will be http://localhost/ instead of http://localhost/Site1/. That means that the server is looking for the images (or whatever) in D:\, instead of looking in D:\Websites\Site1. I've tried several different methods, and I can't get right.

The only place where you can edit root settings in the Default Website. Virtual Dirs do not have that option. The only way of creating fully independant websites (with their own root folder, performance settings, etc) is by using 2000 Server (or any other server OS).

Please, correct me if I'm wrong.
 
Let's take a step back. I'm now thinking this is just a problem in getting your relative URL's correct. Where are your images stored? You should be able to get to them with relative URLS.

For example, if your website is in

D:\WEBSITES\SITE1

and your images are in

D:\WEBSITES\IMAGES then use the following relative URL

src="../images/my_pic.jpg"

If your images are in

D:\WEBSITE\SITE1\IMAGES then use

src="./images/my_pic.jpg"

Have you tried this? What is the exact folder structure of your images relative to your website? The recommended way of writing code to load images is with relative url's.
 
Actually, using absolut paths has it's advantages. For instance, let's say you have a page that uses ssi (server side includes) in order to to show the navigation bar. Using ssi is as simple as <!--#include file="includes/navbar.inc" -->. Now, let's imagine that the page has to be moved to another directory in the site, that would make the above line like this <!--#include file="../includes/navbar.inc" -->, because the includes directory is one level up. If the page has several includes and images, you would have to manually add the ../ to every single line that needs it.

However, should you have used absoluth paths, this would not be a problem. Why?, because the path remains the same: <--#include virtual="/includes/navbar.inc"--> no matter where the page is stored.

Now, the problem is that your site has to have a root directory for it to work, and that's where 2000 Pro's IIS version is limited. This "limited" version of IIS only allows one website with it's own root. Yes, you can create virtual directories, but they cannot have their own root dirs. Your stuck with the default root, wich is wwwroot (if you take a close look on how this dir is shared, you'll notice that the alias for it is / and you cannot change it.

Assuming that I now have my websites stored like this: C:\Inetpub\wwwroot\site1\; C:\Intepub\wwwroot\site2; etc., the solution would be using absoluth paths like this one: <--# include virtual="/site1/includes/navbar.inc" -->. Notice that I've added the site1 level, and that's because the server will look first at the root (wwwroot) and then at the site1 dir. This will work locally, but when you publish your site to the production server, you either will have to scan every line of code and remove the site1/ or simply add the site1 dir to the production server and store the files there.
 
Well, it looks like you have scoped out the problem pretty well. I've learned a thing or two from the dialog.
 
Yeah, well, I did run a few dozen searches in google to find a solution... I guess I'll have to find a way to get 2000 Server, maybe some sort of educational version or something... 2000 Sever is not cheap.

EDIT: I found a $360 Educational version with 5 CALs at Newegg... seems interesting.
 
Originally posted by: mikecel79
What about running Apache on a Linux machine? It's free and very popular. Stable too.

I thought of that too, but I have some clients that use Windows servers and MS SQL servers...
 
Back
Top