Total Pageviews

Sunday, July 13, 2014

HTTP to HTTPS Redirect using Rewrite module

Rule to redirect to HTPS, Illustrated domain is treated as www.yourdomain.com.au, if is www.yourdomain.com the pattern will be pattern="^www\.yourdomain\.com$"

     <rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                        <add input="{HTTP_HOST}" pattern="^www\.yourdomain.com\.au$" />
                        <add input="{HttpsRedirects:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{C:1}" appendQueryString="false" redirectType="SeeOther" />
                </rule>

Pages which are to be redirect, Page ending .aspx and extention less are considered.

  <rewriteMaps>
                <rewriteMap name="HttpsRedirects">
                    <add key="/content_common/application.aspx" value="/content_common/application.aspx" />
                    <add key="/content_common/application" value="/content_common/application" />
</rewriteMap>
</rewriteMaps>

No comments:

Post a Comment