IIS 8 - Redirect HTTP to HTTPS
I came across the need to redirect users who typed in http://site to the secured version https://site. Below are the steps on how to accomplish this.
-
Make sure you've got the URL rewrite module installed in IIS. If you aren't sure if you do or not, you'll find out quickly when you can't find "URL Rewrite" in the steps below. Here are downloads for the 32bit version or the 64bit version.
-
Select your website in IIS and then click on the "URL Rewrite" option in the features pane
-
Once URL Rewrite screen is open, click the "Add Rules..." link in the right hand pane and enter the details as shown below.
-
Select Blank Rule from the inbound rules section.
-
Give it a descriptive name
-
Match URL section:
- Set Requested URL to Matches the Pattern.
- Set Using to Regular Expression
- Set Pattern to (.*)
-
Conditions section. Click Add
- Set Condition Input to {HTTPS}
- Set Check if Input String to Matches the Pattern
- Set Pattern to ^OFF$
- Click OK
-
Actions section
- Set Action Type to Redirect
- Set Redirect URL to https://{HTTP_HOST}/{R:1}
- Set Redirect Type to Permanent(301)
- Click Apply
Now all request to that site should be 301 redirected to the https version of the site.