In this post we will see that in a few simple steps we can create a URL Rewrite to redirect website traffic from http to https.
Prerequisites :
- IIS 7 or higher
- URL Rewrite module installed. Download URL Rewrite 2.1 module from here.
- SSL Certificate installed and configured
Create the rewrite rule
Step 1. Open IIS Manager and go to Start Page – [Server Name] – Sites – {Web Site Name}

Step 2. From the “Features View” pane, open URL Rewrite module.

Step 3. From the right on Action pane click {Add Rules…} – Blank rule

Step 4. In this point we create the Inbound Rule, as the below image shows.

Step 5. Next, we must Add a Condition, like the one in the next image.

| Condition Input | {HTTPS} | Add a condition stating that {HTTPS} is OFF |
| Pattern | ^OFF$ | This pattern ensures that the rule executes ONLY when the request arrives, and will not execute infinitely. |
Step 6. In the final step we configure the Action, on Action Properties we add the value : [https://{HTTP_HOST}/{R:1}], select Redirect type : Permanent (301) and click Apply.

