Skip to content

Instantly share code, notes, and snippets.

@tamys
Last active June 14, 2019 11:35
Show Gist options
  • Select an option

  • Save tamys/7b15ceaac2d191038ae17a51d90ae3df to your computer and use it in GitHub Desktop.

Select an option

Save tamys/7b15ceaac2d191038ae17a51d90ae3df to your computer and use it in GitHub Desktop.
Redirect all non https to https and all non www to www
<rule name="Force WWW and SSL" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^[^www]" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://www.zzz.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Force WWW and SSL" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^[^www]" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://www.zzz.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment