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.

  • 16 Users Found This Useful
Was this answer helpful?

Related Articles

How to Redirect HTTP to HTTPS automatically

If you have a secure certificate (SSL) on your website, you can automatically redirect visitors...

Auto SSL from cPanel is not installing certificate on domain when AutoSSL is run

When you run AutoSSL it does not activate SSL on the domain and the domain gives SSL certificate...

Mixing secure and insecure content on a web page

Problem When visitors to your web site request a page using a...

What is SSL / Secure Certificate?

What is SSL? SSL and Secure Certificates provide security for your website by encrypting...

What is CSR?

What is a CSR? A Certificate Signing Request, or CSR, is a block of encrypted text which...