Force HTTPS redirect (Permanently)
<rule name="Root Hit Force HTTPS Redirection" enabled="false" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_METHOD}" pattern="GET" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/" redirectType="Permanent" />
</rule>
Sitecore Login & Admin Site Force HTTPS Redirection
<rule name="Sitecore Login or Admin Force HTTPS Redirection" enabled="true" stopProcessing="true">
<match url="^(sitecore/(login|admin))$" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_METHOD}" pattern="GET" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
Match a pattern and redirect somewhere else
<rule name="Forbidden" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://destination.com{REQUEST_URI}" appendQueryString="false" />
</rule>
Redirect to non-www site url
<rule name="RedirectWwwToNonWww" stopProcessing="false">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" />
</rule>
Redirect some domains to another domain
<rule name="all domains to destination" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^destination1.com$" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="^destination2.com$" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://destination.com/{R:1}" />
</rule>
Am I missing some? Let me know and I can add more…
~ Delayed gratification is my type of happiness only if I am alive that long. ~