Redirect HTTP to HTTPS IIS

Redirect http to https in IIS.

a. Run the control panel, administrative tool, server manager. Click the “Configure IE ESC” link and turn ESC off for Administrators.
b. Run Internet Explorer and go to the URL: http://www.iis.net/download/urlrewrite
c. Click the link to Install via Microsoft Web Platform Installer. Follow the prompts
d. Create a web.config with the below content

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
        <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
              <match url="(.*)" />
                <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
              <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
            </rule>
        </rules>
        </rewrite>
    </system.webServer>
</configuration>

Leave a Reply