Skip to content

How to send all HTTP traffic to HTTPS pages

by on May 2, 2011


When working in IIS 6, the method below seems to be the simplest approach. It involves creating a custom error page when ssl has been set to required on a website.


Although you should be able to use the method above, I prefer to use the URL rewrite module from Microsoft, rather than the approach above, as it gives you a great deal of flexibility in other areas as well. No server should be without it!

Navigate to the Microsoft URL rewrite module

(you will need to install this if you do not have it)

  1. In IIS 7 click on the website
  2. in the center content area, under “IIS”, double-click on “URL Rewrite” (this should be one of the last icons)
  3. Click on Add Rules > select Blank Rule
  4. Enter the information below

Create A New URL Rewrite Rule

Requested URL: matches the pattern

Using: regular expression

//select everything

Pattern: (.*)

//with the exception of urls already using https


    1. Local Grouping: match all
    2. Add:
      1. Condition Input: {HTTPS}
      2. Check if input string: Matches the pattern
      3. Pattern: off


  1. Action Type: redirect
  2. Action properties:
      1. Redirect url: https://{HTTP_HOST}/{R:0}
      2. Append query string: checked
      3. Redirect type: Found (302)
  1. Luis Sanchez permalink

    I’m having an issue with the conditions. Can explain what 1. Local Grouping: match all means?

  2. jake permalink

    how about if you want to redirect to a virtual folder and not the root website? eg instead of

Leave a Reply

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

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s

%d bloggers like this: