iis , seo , web-config , rewrite-rule , aspnet ,

Redirect HTTP to HTTPS using Web.Config in IIS

Abhith Rajan Abhith Rajan FollowSeptember 25, 2017 · 1 min read · Last Updated:
Share this

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

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

Replace the yourdomain.com 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.

Abhith Rajan
Written by Abhith Rajan FollowBuy me a coffee
Abhith Rajan is an aspiring software engineer with more than 6 years of experience and proven successful track record of delivering technology-based products and services.

Related Services

SmarterASP.net - Unlimited ASP.NET Web Hosting

In hosting, sql-server, aspnet,
ASP.NET Hosting by SmarterASP.net. Unlimited ASP.NET Hosting Plans Starting at $2.95 a month.

Slugify

In seo,
The-online-slug-generator.