How to redirect users from HTTP to HTTPS through an IIS Rewrite

Overview

Users may want to redirect users from HTTP to HTTPS through an IIS rewrite rule. This solution was provided when a user was experiencing issues with enabling the IIS rewrite module.

 

Solution

To accomplish this you must:

  1. First, make sure that the URL Rewrite module has been installed. You can check if this is installed by opening up IIS and clicking on a website and see if the URL Rewrite button is available.2021-01-08_16_41_15-Window.png
  2. Click Blank Rule and Click Ok.2021-01-08_16_51_18-Window.png
  3. Enter any rule name you wish.
    In the Match URL section:
    - Select Matches the Pattern in the Requested URL drop-down menu
    - Select Regular Expressions in the Using drop-down menu
    - Enter the following pattern in the Match URL section: (.*)
    - Check the Ignore case box

    iisredirect1.png

     

  4. In the Conditions section, select Match all under the Logical Grouping drop-down menu and press Add.
    In the prompted window:

    - Enter {HTTPS} as a condition input
    - Select Matches the Pattern from the drop-down menu
    - Enter ^OFF$ as a pattern
    - Press OK

    iisredirect2.png

     

  5. In the Action section, select Redirect as the action type and specify the following for Redirect URL:
    https://{HTTP_HOST}{REQUEST_URI}

    Un-check the Append query string box.
    Select the Redirection Type of your choice. The whole Action section should look like this:iisredirect3.png

     

  6. Click on Apply on the right side of the Actions menu.

Comments

0 comments

Please sign in to leave a comment.