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

Redirect HTTP to HTTPS using Web.Config in IIS

by Abhith RajanSeptember 25, 2017 · 1 min read · Last Updated:

No Stories, just add the below rewrite rule in your Web.Config under system.webServer section so that IIS will take care the redirection of HTTP requests to HTTPS. Since we are about to add a rewrite rule in the IIS,

Before adding the rewrite rule, make sure that you installed the URL Rewrite module in the IIS.

2 <rules>
3 <rule name="httpsredirect" stopProcessing="true">
4 <match url="(.*)" />
5 <conditions>
6 <add input="{HTTPS}" pattern="off" ignoreCase="true" />
7 </conditions>
8 <action type="Redirect" redirectType="Permanent" url="https://yourdomain.com/{R:1}" />
9 </rule>
10 </rules>

Replace the yourdomain.com with the actual domain name and you are good to go.

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

Was this article helpful?

Your opinion matters

Please share your thought about this article

This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub

Related Posts

Related Stories

Related Services

SEO Checker | Test your website for free with Seobility

Instantly review your website for free with the SEO checker from Seobility and get tips for a better search engine optimization and higher rankings.

Screaming Frog SEO Spider

The industry leading website crawler for Windows, MacOS and Ubuntu, trusted by thousands of SEOs and agencies worldwide for technical SEO audits.