Recently, I had a project to setup a product which had instructions in the scenario of a dedicated web server. Since I wanted to install this on an existing web server, I created a virtual host for the site, and installed it. I went through the process of creating the virtual host, binding it to a hostname, which coincided with a DNS entry.
The problem product was setup in such a way that the actual root of the application resides in a subfolder of the root of the site, since this was a vhost, and I did not want people to type in to get to the index of the site, I needed to create an HTTP redirect that goes to

The first thought was to use the IIS 7 built-in HTTP Redirect module. In theory, this sounds like a very viable solution.
So, I tried it, and set it up this way:

IIS 7 HTTP Redirect

You will be surprised to see that this scenario will cause a loop, and will never actually load the page. When looking at the logs, it will look something like this: etc ….

(Chrome will return a 301 ERROR:: TOO MANY REDIRECTS)

In order to resolve this problem, I had to write a URL rewrite that would actually process the URL correctly.

Here’s the correct way to write do this URL rewrite for it to work. There are 2 ways you can do this, either from the GUI, or by editing the web.config file in the root of the site. I’ll show you both methods.

The text file method:

If it doesn’t already exist, go to the root of your site: ( , and create a file called web.config, then put the following in it:

            <rule name="Root Hit Redirect" stopProcessing="true">
                <match url="^$" />
                <action type="Rewrite" url="/psp/app" /&>

The GUI method:

In the GUI, go to URL Rewrite, then right-click in the “Inbound Rules”, and create a new rule, and choose a “Blank Rule” template from the Inbound Rules.
Now, fill in the rules as follows:

URL Rewrite Inbound Rule

Once this rule is in place. Reload the page, and the redirect should happen as expected.


Print Friendly, PDF & Email
Subscribe By Email for Updates.