Skip to content

Instantly share code, notes, and snippets.

@yaplex
Created June 21, 2017 19:18
Show Gist options
  • Select an option

  • Save yaplex/3c8df10a0079696b5d3be4ab097c82dd to your computer and use it in GitHub Desktop.

Select an option

Save yaplex/3c8df10a0079696b5d3be4ab097c82dd to your computer and use it in GitHub Desktop.
<system.webServer>
<rewrite>
<rewriteMaps configSource="rewrite-maps.config" />
<rules>
<rule name="Remove WWW prefix for com domain">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.yaplex\.com" /> </conditions>
<action type="Redirect" url="https://yaplex.com/{R:1}" redirectType="Permanent" /> </rule>
<rule name="Convert to lower case">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />
<conditions>
<add input="{URL}" pattern="^.*/admin" negate="true" /> </conditions>
</rule>
<rule name="Remove trailing slash">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" /> </rule>
<rule name="static Redirect from map file">
<match url=".*" />
<conditions>
<add input="{StaticRedirects:{REQUEST_URI}}" pattern="(.+)" /> </conditions>
<action type="Redirect" url="{C:1}" redirectType="Permanent" /> </rule>
<rule name="Redirect to HTTPS">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" /> </conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /> </rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment