The simple way to force redirect to https in web config files - Digital Tool Factory blog The simple way to force redirect to https in web config files - Digital Tool Factory blog

The simple way to force redirect to https in web config files

There are two things:
1. Just insert this code in the web.release.config

<system.webServer xdt:Transform=”Insert”>
<rewrite>
<rules>
<rule name=”Force HTTPS” enabled=”true”>
<match url=”(.*)” ignoreCase=”false” />
<conditions>
<add input=”{HTTPS}” pattern=”off” />
</conditions>
<action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}” appendQueryString=”true” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>

2. Then make sure that the Url Rewrite module is installed in IIS – if that module is not installed you will get perplexing, unhelpful error messages

 

Written By Steve French

 

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.