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.
Windows Tutorial:
On this page, we offer quick access to a list of Windows tutorials.
Tutorial IIS – Redirect HTTP to HTTPS
Access the URL REWRITE website and download the installation package.
Perform the URL REWRITE installation.
Start the application named: IIS Manager.
On the IIS Manager application, select your website.
On the right part of the screen, access the option named: URL Rewrite.
On the top right part of the screen, click on the Add Rule option.
Create a new 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.
On the Conditions area, select the Match all option.
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.
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
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.
Optionally, you may use the CURL command of a Linux computer to verify the HTTP to HTTPS redirection.
Here is the command output.
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.