rick graner dot com

developers! developers! developers!
musings of my creative and technical writing

automatically make your web.config file force from HTTP to HTTPS for SSL Security

I know this answer is out there in some form or fashion but I like to have it here for quicker access. This is the section of code that I use to force all of my websites to roll over to SSL in my web.config file.

            <clear />
            <rule name="Redirect to https" stopProcessing="true">
                <match url=".*" />
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />