IIS Redirect HTTP to HTTPS

We needed to redirect from HTTP to HTTPS as some of our sites weren’t yet updated to cope with HTTPS
So instead of doing it for all sites on our IIS server we needed to do it for one to start with and leave the others intact.

This is how we did that.

First thing you need is a IIS module which isnt installed as standard, URL Rewrite. Instead of just clicking the large green button which Microsoft would like you to do, scroll down and download just the file version that you need.

Once you’ve installed this, you will need to restart your IIS on that server, we have 3 which are load balanced, so had to install this module on all 3 and restart all 3 in order to see the icon.

Hopefully Microsoft wont say you need to reboot the machine in order to install this, if you do get this message then you don’t have much choice apart from do what it is saying.

Okay, now launch the ‘URL Rewrite‘ module and do the following:

Add Rule(s)…‘ then select ‘Blank Rule‘.

Fill out the following as in the following screen, under ‘Match URL‘:


The regular expression is as follows:


Where ‘resultsonline‘ replace this with the name of application you want to jump to HTTPS

A break down of the what the above regular expression is doing:

^ = The match must start at the beginning of the string or line.
$ = Match must occur at the end of the string
| = Matches any one element separated by the vertical bar
/.+$ = / is just a slash . means Any + one or more $ end of the line, so it has to equal “/something” rather than /.* would match “/” or “/something”

In the ‘Conditions‘ section, click ‘Add…‘ and enter:


Then in the ‘Action‘ section, change the setting to:


Click ‘Apply‘ to save the rule.

Include the above with a binding for HTTPS and http://www.server.com/resultsonline will redirect to https://www.server.com/resultsonline

If you want to redirect all your sites from HTTP to HTTPS then just change the regular expression to (.*)

Hope it helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s