How Do I Redirect HTTP to HTTPS Automatically?

Redirect http To https Automatically:

To redirect http to https automatically just add below mentioned code in web.configuration file under <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>

Just save the web.config file and your domain is all set to redirect to https automatically.

Var dette svaret til hjelp? 17 brukere syntes dette svaret var til hjelp (45 Stemmer)