Would you like to learn how to redirect HTTP to HTTPS on IIS? In this tutorial, we are going to show you how to install the URL Rewrite module on the IIS server and create a rule to redirect the HTTP traffic to HTTPS on a computer running Windows.

• Windows 2012 R2
• Windows 2016
• Windows 2019

Hardware List:

The following section presents the list of equipment used to create this tutorial.

Every piece of hardware listed above can be found at Amazon website.

Tutorial IIS - Redirect HTTP to HTTPS

Access the URL REWRITE website and download the installation package.

IIS URL REWRITE DOWNLOAD

Perform the URL REWRITE installation.

URL REWRITE INSTALLATION

Start the application named: IIS Manager.

Start IIS Windows

On the IIS Manager application, select your website.

On the right part of the screen, access the option named: URL Rewrite.

IIS - URL REWRITE - WEBSITE

On the top right part of the screen, click on the Add Rule option.

IIS URL REWRITE - ADD

Create a new Blank rule.

URL REWRITE BLANK RULE

To redirect HTTP to HTTPS, use the following configuration:

• Name - Enter a name to the new rule.
• Requested URL - Matches the Pattern.
• Using - Regular Expressions.
• Pattern - (.*)
• Ignore case - Yes.

IIS - Redirect HTTP to HTPS

On the Conditions area, select the Match all option.

IIS - HTTP to HTTPS

Click on the Add button and use the following configuration:

• Condition input - {HTTPS}
• Check if input string - Matches the Pattern
• Pattern - ^OFF$
• Ignore case - YES

Click on the OK button.

IIS - HTTP to HTTPS redirection

On the Action area, configure the HTTP to HTTPS redirection.

• Action type - REDIRECT.
• Redirect URL - https://{HTTP_HOST}{REQUEST_URI}
• Append query string - NO.
• Redirect type - 301.

On the top-right part of the screen, click on the Apply option

Redirect HTTP to HTTPS - IIS

On the IIS server, open your browser and enter the IP address of your web server using the HTTP protocol.

In our example, the following URL was entered in the Browser:

• https://127.0.0.1

The HTTPS page should be presented.

IIS SSL TLS

Optionally, you may use the CURL command of a Linux computer to verify the HTTP to HTTPS redirection.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

In our example, if a user tries to access the HTTP version of any page, he will be redirected to the HTTPS version of the same page.

Congratulations! You successfully configured the HTTP to HTTPS redirection on the IIS server.