Redirect http to https with IIS 7

In order to Redirect HTTP to HTTPS on your website, manually edit the web.config file of site and add the following rewrite rule:

<?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>