Setting up an HTTP/HTTPS Redirect in IIS

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Step-by-Step Instructions for using a URL Rewrite to Redirect HTTP to HTTPS in IIS

Before you can set out with an HTTP/HTTPS redirect in IIS, you’ll need to make sure that you have an SSL certificate already installed. This is not a step you can skip. Once you’ve got the certificate installed, we can start working on a URL rewrite to redirect your traffic to your new-fangled HTTPS site.
Let’s get started.

1. Download and install the IIS URL Rewrite Module

2. Open IIS Manager, in the console select the website you want to redirect

3. Select URL Rewrite

4. Click Add Rules

5.Select Blank Rule, click OK

6. Enter the Name of rule

7. In the Match URL section choose “Matches the Pattern” in the Requested URL drop-down

8. Next select “Regular Expressions” in the Using drop-down

9. In the Match URL section enter: “(.*)

10. In the conditions section, select Match All under Logical Grouping, the click Add

11. In the next window: 

  • Enter {HTTPS} as the condition input
  • Select “Matches and Pattern” from the drop-down
  • Enter ^OFF$ as the pattern
  • Click OK
12. In the Action section, click Redirect and then specify the Redirect URL as: https://{HTTP_HOST}/{R:1}

13.Check the Append Query String box

14. Choose your redirection type (301)

15. Click Apply

Next, you’ll have to apply the rule to your website.

1. In the IIS dashboard, right click on your site and select Explore

2. Your Root Directory will open, select the web.config file and open it

3. Make sure the file contains the following code block (if not, add it)

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

4. If you haven’t web.config file in your root directory, create new .txt file, just place the above code in it, save and then rename the file to web.config.

Download Site Seal
SSL Checker

Pin It on Pinterest

Share This