Creating 301 Redirects on IIS7

I've been moving a site from Windows Server 2003 to Windows Server 2008 and thought I would mention one of the items I ran into this evening.I needed to setup 301 redirects for some old domain names that we no longer use and at first glance could not figure out where to do so.

One of the first items I need to remind myself of when working with IIS7 is to stop looking for obvious features aimlessly, but instead head to the Roles section of the Server Manager to install the feature. Many of the commonly used features in IIS7 are not installed by default and require being added as a Server role. HTTP Redirection is one of those features and if you want to redirect old domains to a current domain you will need to install the feautre.

One problem that I ran into when setting up my old domains was what to select as the Physical Path when creating the site. The wizard forces you to pick a path even if you plan to redirect the site to a url. I made the mistake of selecting the root folder of the site I planned on redirecting to, which of course caused an error for both sites due to a continuous redirection. After creating an empty directory for theĀ  site I wanted to redirect, I was able to correctly point it to the correct url.

One nice feature added to IIS7 is that by default, it will redirect to a relative path passing all url variables without using the $v and $p parameters.Once you get used to the new interface for creating http redirections I think you will find it to be an improvement over IIS6.

Posted on: Feb 8, 2010

Comments

Write your comment



(it will not be displayed)



Leave this field empty: