Redirect HTTP to HTTPS in IIS

One of our developers wanted to automatically redirect http requests to https, so if a user browsed http://www.itfountain.com then they should be automatically redirected to https://www.itfountain.com. A simple enough task to accomplish with a line of configuration in Apache:

Redirect permanent / https://www.itfountain.com/

Unfortunately the web server is IIS and not Apache.  Fortunately there is an IIS extension called URL Rewrite that can accomplish this.

Head over to http://www.iis.net/downloads/microsoft/url-rewrite, download and install the extension.  It’s a very quick install and doesn’t require a reboot, at least not on Windows 2008 R2.

Once installed select the website you want to add the redirect to and there should be a new feature called URL Rewrite.

image1

Open the feature and click on ‘Add Rule(s)…

image2

Start with a ‘Blank Rule

image3

There are several sections that must be filled in to create the rule.  In the ‘Match URL‘ section fill in the details as follows.

image4

Add a new conditon In the ‘Conditions‘ section by clicking on ‘Add…

image5

Fill in the rule in as follows.

image6

Finally, fill in the ‘Action‘ as follows.

image7

Click ‘Apply

image8

And the rule should be complete and working.

image9

Tags: ,

No comments yet.

Leave a Reply