IIS 8 – HTTP to HTTPS Redirect

 

1) Download and install the URL Rewrite 2.0 module to your IIS8 server:

64bit URL Rewrite Module Download

32bit URL Rewrite Module Download

2) Once installed, open IIS Manager, expand the Sites container and select the website you wish to configure the http redirection.

3) Once highlighted, doubleclick the URL Rewrite option in the right hand pane. Select Add Rule and configure the following:

NAME

  • Select: Blank Rule
  • Name: http to https
  • Match URL – Requested URL: Matches the Pattern
  • Match URL – Using: Regular Expression
  • Pattern: (.*)

CONDITIONS

  • Conditions: Add
  • Condition Input: {HTTPS}
  • Check if input string: Matches the Pattern
  • Pattern: ^OFF$
  • Click OK

ACTION

  • Action type: Redirect
  • Redirect URL: https://{HTTP_HOST}/{R:1}
  • Redirect type: See Other (303)
  • Click Apply

Requests to your site via HTTP should now be redirecting to HTTPS.

16 thoughts on “IIS 8 – HTTP to HTTPS Redirect”

  1. what should i mention in the Redirect URL?do i have to mention same as shown in the action asRedirect URL: https://{HTTP_HOST}/{R:1} . or do i need to mention my website link which is going to be redirect.

  2. I get a following warning ‘the Rule back reference “1” is not valid’ and when I browse to the http website, I see the following error.

    HTTP Error 500.50 – URL Rewrite Module Error.

    The expression “https://{HTTP_HOST}/{R:1}” cannot be expanded.

  3. Thanks, that worked quite well.
    I couldn’t apply it to the ‘Default Web Site’ like I originally intended, but it worked when I put it on the specific subfolder I needed.

    1. Wow, thanks Gaston. I struggled the whole morning why this wasn’t working and yes, switching off the “require SSL” made it work. EUREKA !!!!!

  4. Thank you very much for this clear instruction.
    One thing though, I had to change Pattern: ^OFF$ to a simple off to make it work (on Windows 2012 r2)

  5. This doesn’t appear to work for Safari browsers, but does work for Chrome and IE – any reason why safari would not follow the redirect?

Leave a Reply

Your email address will not be published. Required fields are marked *


*