Redirect http to https on Windows Hosting

Redirect from HTTP to HTTPS using the IIS URL Rewrite module

Windows runs a little differently since there is no .htaccess file. It now uses web.config files.

Simply edit this file for your needs and where you want to redirect to:

Note: web.config file modifications

The URL rewrite rules get written to the web.config file for the site you are working in. For example, the above configuration should result in this addition to the web.config file:

<rewrite>
<rules>
<rule name=”Redirect to http” enabled=”true” patternSyntax=”Wildcard” stopProcessing=”true”>
<match url=”*” negate=”false” />
<conditions logicalGrouping=”MatchAny”>
<add input=”{HTTPS}” pattern=”off” />
</conditions>
<action type=”Redirect” url=”https://{HTTP_HOST}{REQUEST_URI}” redirectType=”Found” /> </rule>
</rules>
</rewrite>