Introduction

In our previous guide, we got to learn how to use the default site that IIS Webserver comes with after installation. We are going to explore the concept of a virtual directory in this guide and first, let us get to know what a virtual directory is. According to Microsoft, a virtual directory is a directory name (also referred to as path) that you specify in Internet Information Services (IIS) and map to a physical directory on a local or remote server. The virtual directory name becomes part of the application’s URL, and users can request the URL from a browser to access content in the physical directory, such as a Web page.

Adding a Virtual Directory to IIS Server 2019

These are the steps you’ll use to add a Virtual Directory to Windows IIS Server 2019.

Step 1: Open your Server Manager

Open Server Manager and proceed to the IIS Manager.

Server manager open iis manager from tools 2

Step 2: View Virtual Directories

Navigate to the “Default Web Site” and then click on “View Virtual Directories” located at the far right as shown below. In the page that opens, we shall be able to add a new Virtual Directory.

IIS Manager View virtual directories

Step 3: Add Virtual Directory

You can either right-click the middle section under “Virtual Directories” of the page or click on “Add Virtual Directory” as illustrated below. A smaller pop-up window titled “Add Virtual Directory” will result.

IIS Manager Right click to Add virtual directory

Step 4: Key in Alias and choose Physical Path

On the small pop-up window, input your desired “Alias” and choose a “Physical Path” where you would wish to place the files to be loaded later. Make sure that IIS has permissions to read from the directory you will choose or else your pages won’t load. Click “OK” after you are done. You will see your Virtual Directory added.

IIS Manager Add new virtual directory plus path
IIS Manager Virtual Directory added

Step 5: Add your files in the physical path

If your files are ready, copy them into the Physical Path you specified above. We are going to use a basic HTML file to illustrate. Remember once again that IIS must have permission to read from this Physical Path/directory.

IIS Manager index file in newvirtualspace

Step 6: Try loading the site

Open your favorite browser and point it to the alias name we specified earlier. Ours was “geeksvirt“. If you are not loading if from local, input the IP address of IIS Server. And yeah, the page loads.

IIS Manager virtual direcoty page loaded

Conclusion

We have added a virtual directory in IIS Webserver. You can as many virtual hosts as you wish to serve your application and be happy. Thank you for spending your time on this site and we hope the guide was helpful. Next, we are going to add new websites apart from the Default Web Site in IIS.

More on IIS:

How To Configure Default Site in IIS Server 2019

Install and Configure IIS Web Server on Windows Server 2019

Run Docker Containers on Windows Server 2019

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here