Last active
January 25, 2016 17:28
-
-
Save jamescoxhead/5592e774da3ce7c10b14 to your computer and use it in GitHub Desktop.
Hygiene Umbraco redirect rules (based on http://24days.in/umbraco/2014/redirect-rules/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<rules> | |
<rule name="Whitelist" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions logicalGrouping="MatchAny"> | |
<add input="{URL}" pattern="^/(umbraco|install)(.*)" /> | |
</conditions> | |
<action type="None" /> | |
</rule> | |
<rule name="CanonicalHomepage1" stopProcessing="true" enabled="true"> | |
<match url="^default\.aspx$" /> | |
<action type="Redirect" url="http://{HTTP_HOST}/" /> | |
</rule> | |
<rule name="CanonicalHomepage2" stopProcessing="true" enabled="true"> | |
<match url="^home/$" /> | |
<action type="Redirect" url="http://{HTTP_HOST}/" /> | |
</rule> | |
<rule name="AddTrailingSlash" stopProcessing="true" enabled="true"> | |
<match url="(.*[^/])$" /> | |
<conditions> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
<add input="{URL}" pattern="\.(?:css|png|jpg|axd|ashx|html|gif|doc|docx|pdf|aspx|txt|xml)$" negate="true" /> | |
<add input="{QUERY_STRING}" pattern="^$" /> | |
</conditions> | |
<action type="Redirect" url="{R:1}/" /> | |
</rule> | |
<rule name="RemoveAspx" stopProcessing="true" enabled="true"> | |
<match url="(.*).aspx$" /> | |
<conditions> | |
<add input="{URL}" pattern="\.aspx$" /> | |
</conditions> | |
<action type="Redirect" url="{R:1}/" /> | |
</rule> | |
<rule name="CanonicalHostName" stopProcessing="true" enabled="true"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTP_HOST}" pattern="^domain\.com$" /> | |
</conditions> | |
<action type="Redirect" url="http://www.domain.com/{R:1}/" /> | |
</rule> | |
</rules> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules configSource="config\Redirects.config" /> | |
</rewrite> | |
</system.webServer> | |
</configuration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment