Understanding Virtual Directories with IIS

A virtual directory is simply a subfolder of a Web site, but one with a difference – it doesn’t necessarily have to exist within the root of your Web site. For example, if you create folders and subfolders within the C:\Inetpub\wwwroot directory, these automatically become virtual directories of your Web site, accessible by appending /foldername after the address of your server in Internet Explorer. However, virtual directories can also exist in locations outside of the root of your website, including in a different path, on a shared folder on a different server, and so forth. When you use the Virtual Directory Creation Wizard, an alias can even be assigned to a folder to give it a different name for web access. For example, the folder C:\shared documents could be made a virtual directory with an alias of docs. Then, when a user needs to access this folder on your Web site, they would simply supply the name of the server with /docs appended to the address. For details on creating a virtual directory using the wizard, see the steps below.

In the same way that you can configure Web site settings via the properties of the site, the same is true for a virtual directory. Right-click on the virtual directory and click Properties to configure the Directory, Documents, Directory Security, HTTP Headers, and Custom Errors settings for that virtual directory. These settings are basically identical to those looked at in the properties of the Default Web Site, but provide for more granular control since they apply to a certain virtual directory only.

Step 1: Click Start, and then click Control Panel. Double-click on the Administrative Tools applet. This will provide a list of all Administrative Tools installed on your system. Double-click Internet Information Services.

Step 2: In the Internet Information Services window, click the plus signs next to your computer name and Web Sites to expand them. Right-click on the Default Web Site icon, select New, and then click Virtual Directory.

Step 3: At the Virtual Directory Creation Wizard Welcome screen, click Next. At the Virtual Directory Alias screen type a name for the virtual directory. This will be the name that users access the virtual directory by. Click Next.

Step 4: At the Web Site Content Directory screen, enter the path in which the virtual directory content exists, for example C:\webdocs or browse to the location. The name of this directory can be different from the Alias you assigned in Step 3. Click Next.

Step 5: At the Access Permissions screen, review the permissions assigned by default. If you want users to be able to view and access the contents of a directory via hyperlinks, check the Browse option. Once complete, click Next. Click Finish to complete the wizard.

Step 6: In the Internet Information Services window, click the Default Web Site icon. Notice that the site now includes a virtual directory named testing in this example, and that the path to this virtual directory is C:\webdocs.

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of 2000Trainers.com. He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.