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




<rule name="HTTP to HTTPS redirect" stopProcessing="true">

  <match url="(.*)" />


      <add input="{HTTPS}" pattern="off" ignoreCase="true" />


  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />





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

Was this answer helpful? 19 Users Found This Useful (86 Votes)