Using Virtual Directories (IIS 6.0)
A virtual directory is a friendly name, or alias, either for a physical directory on your server hard drive that does not reside in the home directory, or for the home directory on another computer. Because an alias is usually shorter than the path of the physical directory, it is more convenient for users to type. The use of aliases is also secure because users do not know where your files are physically located on the server and therefore cannot use that information to modify your files. Aliases also make it easier for you to move directories in your site. Rather than changing the URL for the directory, you change the mapping between the alias and the physical location of the directory.
If your Web site contains files that are located in a directory other than the home directory, or on other computers, you must create virtual directories to include those files in your Web site. To use a directory on another computer, you must specify the directory's Universal Naming Convention (UNC) name, and provide a user name and password for access rights.
If you want to publish from any directory not contained within your home directory, you must create a virtual directory. For example, suppose you are setting up a Web site for your marketing team on your company's intranet. The following table shows the mapping between the physical location of the files and the URL that accesses the files.
Both virtual directories and physical directories (directories without an alias) appear in IIS Manager. A virtual directory is indicated by a gear icon. The following illustration shows the Web site example described above, where /Customers and /PR are virtual directories.
For a simple Web site, you might not need to add virtual directories. You can simply place all of your files in the site's home directory. If you have a complex site, or want to specify different URLs for different parts of your site, you can add virtual directories as needed. To make a virtual directory accessible from multiple sites, you must add the virtual directory to each site.
There are three ways to create or delete a virtual directory:
You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type runas /User:Administrative_AccountName"mmc %systemroot%\system32\inetsrv\iis.msc".
To create a virtual directory using the Virtual Directory Creation Wizard
To create a virtual directory by importing a configuration file
The following method is available only if your server's hard disk is formatted with the NTFS file system.
To create a virtual directory using Windows Explorer
You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer\Administratorcmd to open a command window with administrator rights and then type cscript.exeScriptName (include the script's full path and any parameters).
To create a virtual directory using the Iisvdir.vbs administration script
Deleting a virtual directory does not delete the corresponding physical directory or files.
To delete a virtual directory using IIS Manager
To delete a virtual directory using Windows Explorer
The following method does not work for root virtual directories.
To delete a virtual directory using the Iisvdir.vbs administration script