Redirect HTTPS requests to HTTP using IIS Rewrite rule in Web.Config

The below-given rewrite rule which redirects all the HTTPS request to its HTTP URL. Redirecting HTTPS to HTTP isn't recommended considering many factors. If you don't have SSL purchased for your website, there are some cool options, like Cloudflare, it has a free package where it adds security to your site as well as provides free SSL, will write about it in a separate post.

<rewrite>
      <rules>
        <rule name="Redirect to HTTP" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^ON$" />
          </conditions>
          <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>

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