HTTP to HTTPS redirect

Before starting this process, make sure that you can access your site using http and https separately.  Browse to http://SERVERNAME and https://SERVERNAME

1. Install SSL Certificate in IIS

Follow Step 1 and 2 of this article

2. Adjust bindings for website in IIS (typically 443 for https, port 80 for http)

3. Install URL Rewrite Module

 http://www.iis.net/downloads/microsoft/url-rewrite

4.  Create a URL Rewrite Rule. This can be done in IIS (pictured below) or add the rewrite code below into the web.config file on the server.

Location of web.config file on the web server:  In the folder identified as the web root in IIS Look at the Basic Settings for your IIS website

 

Where to put the code inside the web.config file:  Between <system.webServer> and </system.webServer> tags (the rest of the code may vary from screenshot)

Rewrite code to insert:

  <rewrite>

  <rules>

  <rule name="HTTP to HTTPS redirect" stopProcessing="true">

  <match url="(.*)" />

  <conditions>

  <add input="{HTTPS}" pattern="off" ignoreCase="true" />

  </conditions>

  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />

</rule>

</rules>

</rewrite>

After implementing the rule, it should look like this in IIS:

* Note for 13.5 

There are other rewrite rules present in this version.  This rule for redirect should go above the others (1st)

5.  Ensure Require SSL is not checked at the Root of the website under SSL Settings, this may cause an error page when browsing the site over HTTP

Have more questions? Submit a request

0 Comments

Article is closed for comments.