How to configure IIS Redirect HTTP to HTTPS
To Configure IIS7 ,IIS8 to force using HTTPS for website follow these steps
- Make sure that Microsoft URL Rewrite Module installed on your server
- Install your SSL certificate in IIS 7 and bind it to your website or if you already install the SSL you can skip this step.
Make sure Require SSL is NOT checked under SSL Settings for your website (uncheck the boxes that are checked in this screenshot)
Locate your web.config file on your root folder of your website and edit the file and locate <system.webServer> section and add the following after that section
<rewrite>
<rules>
<rule name=”http to https” stopProcessing=”true”>
<match url=”(.*)” />
<conditions>
<add input=”{HTTPS}” pattern=”^OFF$” />
</conditions>
<action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}” redirectType=”Temporary” />
</rule>
</rules>
</rewrite>
- Now you can check if your website by enter www.youdomain.com in the browser ,It should redirect to the https version.