Redirect HTTP to HTTPS using Web.Config in IIS

Use IIS Rewrite rule to redirect all HTTP request to HTTPS.

commit d90853a · authored · 1 min read

Redirect HTTP to HTTPS using Web.Config in IIS

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.

<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.

local graph · open full graph

"Redirect HTTP to HTTPS using Web.Config in IIS" is connected to the topics Internet Information Services, Search Engine Optimization, Web.config, Rewrite Rules, ASP.NET and related to 6 other entries. Redirect HTTPS requests to HTTP using IIS Rewrite rule in Web.Config Redirect HTTPS requests to … Redirect WWW to Non-WWW using Web.Config in IIS Redirect WWW to Non-WWW usi… Redirect non-www urls to www urls Redirect non-www urls to ww… C# - Get Web.Config Connection String in a Class Library C# - Get Web.Config Connect… IIS - Disable CORS IIS - Disable CORS IIS - OPTIONS Requests Returns 404 IIS - OPTIONS Requests Retu… Internet Information Services #iis Search Engine Optimization #seo Web.config #web-config Rewrite Rules #rewrite-rule ASP.NET #aspnet Redirect HTTP to HTTPS using Web.…

comments

loading discussion…