Home How toASP.NET Force all traffic from HTTP to HTTPS using Web.Config file

Force all traffic from HTTP to HTTPS using Web.Config file

by wikky

Once you have setup your SSL the next thing is to redirect all traffic of your website from HTTP to HTTPS. By default your website is accessible from HTTP. And you can configure it by many ways at IIS, Application coding level or WEB.CONFIG file. The simplest way to do it at WEB.CONFIG level.

Open Asp.Net WEB.CONFIG file and Put following rewrite rule tags under the <system.webServer> tag.

    <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}"/>

Save and publish it on server. Now check your website will start loading at HTTPS.

Hope this works!

You may also like

1 comment

Esteban July 1, 2021 - 7:04 am

Hello are using Wordpress for your blog platform? I’m new to the blog world but I’m trying to get
started and create my own. Do you need any html coding expertise
to make your own blog? Any help would be really appreciated!


Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More