Redirect non-SSL to SSL in Windows (IIS)

The following code sample will 301-redirect to with the following requirements:

1. IIS v7 (Windows 2008) or newer

2. The site's application pool runs in "integrated" mode

3. The URL Rewrite module is installed

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTPS}" pattern="off" ignoreCase="false" />
                    <action type="Redirect" url="https://{HTTP_HOST}{URL}" redirectType="Permanent" />
                </rule> </rules> </rewrite> </system.webServer> </configuration>
Was this answer helpful? 0 Users Found This Useful (0 Votes)