Updated on Kisan Patel
How to redirect HTTP to HTTPS in IIS?
Open Web.config file and add following rewrite rule:
<?xml version="1.0" encoding="utf-8"?> <configuration> ... <system.webServer> .... <rewrite> <rules> <rule name="HTTPS force" enabled="true" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> ... </configuration>
That’s it.