Redirect from HTTP to HTTPS on IIS using URL Rewrite module

0
55504

Before you continue, you need to ensure that the URL Rewrite Module for IIS has been installed on your IIS Web server. You can download and install it from this link. IIS URL Rewrite enables Web administrators to create powerful rules to implement URLs that are easier for users to remember and easier for search engines to find.

Below is Step by Step Instructions for HTTP to HTTPS redirect:
1. Ensure that the IIS site you are using is configured for the proper port 80 binding. In this case, we are listening for all traffic on port 80. But you could restrict this based on host header as needed.

2. Go to the site that you want to configure and select URL Rewrite and select Add rule on top right section and Blank Menu.

3. Configure the “Edit Inbound Rule” as follows:
On Match URL Section:

On Condition Section:

On Action Section:

4. Apply your configuration and make sure the Rewrite rule is enabled.

Another way, you can create theĀ URL rule for HTTPS redirection directly in web.config file as below:

<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>  

LEAVE A REPLY

Please enter your comment!
Please enter your name here