Force to redirect to using IIS 7

Yesterday I wrote a post about how to achive a redirect for to using IIS 6. Today I will show you how easy it is to set this up for IIS 7 on Win Server 2008.

You should be aware that this install requires a reboot. Only install on your server if you are in a position to restart your server.

First thing you need to do is download the rewrite module for IIS 7 from Microsoft. The 32bit version is here and the 64bit version here.

Before you can install this module you need to stop some services running on your server. Open the command prompt (Start -> Run -> type cmd and press enter) and type: net stop was /y

Now double click on the file you just downloaded and install the product. It can take a few mins and look like it's after hanging but give it a moment and it will install for you. You will be prompted to restart your server. Do this now as without a restart IIS will give you a 503 HTTP error when attempting to display a webpage.

Once the server has restarted open IIS Manager and make sure that both your domain and relevant application pool have been restarted.

Open up your browser and test your site just to double check everything is ok after the install. You should find that everything is working as normal.

You can now put the following rule in your web.config file within the <system.webServer> tag:


Save and FTP the web.config file to your server. If you type in (without www.) you should notice that it redirects you to now.

For more information about rerouting your traffic you can visit the IIS site for more details. A great place to start is on the Rule with Rewrite Map page.

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

You can also contact me by email.

Latest Tweets