Redirect HTTP to HTTPS with IIS 10
Redirect HTTP to HTTPS with IIS 10
1. Launch IIS Manager and select the website under the connections section on the left
If you don’t see the “URL Rewrite” button, you need to install “URL Rewrite” extension
https://www.iis.net/downloads/microsoft/url-rewrite
2. Click on “URL Rewrite” button.
3. On the next screen click on “Add Rule(s)” link on the right side menu.
4. Select “Blank Rule”, then click OK button.
5. On the next screen, enter the following details
6. Enter a user-friendly name like we used “Redirect-To-HTTPS”. Then, under the Match URL section, set Requested URL to “Matches the Pattern” and set Using to “Regular Expressions“. Then set the Pattern type to (.*) as shown in the below screenshot.
1
2
|
Name = Redirect-To-HTTPS
Pattern = (.*)
|
Keep all other options default.
7.Scroll down, expand “conditions” on the same screen. Click on Add button
Expand the Conditions block. Under Logical Grouping change the drop-down to Match All and click on Add. Under the Condition input box type “{HTTPS}“. In the input string select “Matches the Pattern” and set the Pattern value to “^OFF$“.
1
2
|
Condition input = {HTTPS}
Pattern = ^OFF$
|
Click “OK” button.
8.Scroll Down to the actions section.
Expand the Action block. Select the Redirect option in the Action Type dropdown. Set the Redirect URL to “https://{HTTP_HOST}/{R:1}“. Append query string must be checked and set the Redirect type select Permanent (301). Then click the Apply button in the right sidebar.
1
2
3
|
Action type = Redirect
Rewrite URL = https://{HTTP_HOST}{REQUEST_URI}
Redirect type = Permanent (301)
|
Click “Apply” from the right side “Actions” menu to save the changes.