Redirect HTTP to HTTPS using Web.Config in IIS

Add the below rewrite rule in your Web.Config under system.webServer section,

        <rule name="httpsredirect" stopProcessing="true">
          <match url="(.*)" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          <action type="Redirect" redirectType="Permanent" url="{R:1}" />

Replace the with the actual domain name and you are good to go. If this isn't working, make sure that you installed the URL Rewrite module in the IIS.

comments powered by Disqus

About the author

  • Abhith Rajan

    Abhith Rajan

    Abhith Rajan is a full-stack developer, consultant, Sysberries employee, and biker. Who passionate about C# and JavaScript. Works on his blog, his personal finance web app and its react native mobile app in his free time.

    Buy me a coffeeBuy me a coffee