Redirecting from HTTP to HTTPS

Redirecting from http to https is a common issue now days. Https is the secure protocol to go ahead in the requirement of payment sides or payment gateway integration.

So here I am going to explain you guys a very simple way to redirect you web address from http to https.

Prerequisites - First of all you need to have a SSL certificate and it should be installed in your IIS server. You also need to keep in mind the URL rewrite functionality is available in IIS 7 and higher versions.

Implementation - To achieve the redirection from http to https you need to include below code in your web config file under the <system.webserver> tag.

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

I hope it will help someone in achieving the same. 

Ebook Download
View all
Learn
View all