IIS Url Rewrite HTTP to HTTPS

April 30, 2017

When you setup a website in IIS you can bind it to different ports and also bind it with an SSL certificate. See my previous post on Free SSL's through Let's Encrypt. To setup IIS to redirect traffic that navigates to your site without SSL (http) to your secure binding (HTTPS) you'll setup an IIS Url Rewrite Rule. If this package was not installed, you may need to navigate to Server Manager and add the extension to the IIS node.

To create the Url Rewrite Rule, navigate to the home page within IIS for the site you want to manage. The Url Rewrite icon is located in the IIS section, second from the last. Click into it, then click on Add Rule in the top actions pane. Add a new Blank Inbound rule, set the name to something friendly like 'Http to Https' and then set the following other options.

  • Requested Url :: Matches the Pattern
  • Using :: Wildcards
  • Pattern: *
  • Ignore Case Checked
  • Logical Grouping :: Match All

 

Add a new condition with the following properties.

  • Condition Input :: {HTTPS}
  • Matches the Pattern
  • Pattern :: off
  • Ignore Case Checked

 

Save the rule, restart the site, and you should see that if you navigate to your site without https (so http://example.com) it will redirect to https (assuming that you have both bindings setup for the site).

Share

Comments