Created
May 22, 2015 17:03
-
-
Save chrisgalvan/41578fc7a68b565f5f56 to your computer and use it in GitHub Desktop.
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
<!-- Redirect to HTTPS --> | |
<rule name="HTTPS_AlwaysOn" patternSyntax="Wildcard" stopProcessing="false"> | |
<match url="*" /> | |
<serverVariables> | |
<set name="HTTPS" value="on" /> | |
</serverVariables> | |
<action type="None" /> | |
<conditions> | |
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" /> | |
</conditions> | |
</rule> | |
<!-- 301 Redirect --> | |
<rule name="Simple_301_Redirect" stopProcessing="true"> | |
<match url="Control/Some/productID/(.*)"/> | |
<action type="Redirect" url="Catalog/Category/Product/{R:1}" redirectType="Permanent" /> | |
</rule> | |
<!-- 301 Redirect that uses a rewrite map --> | |
<rules> | |
<rule name="Example_Rewrite" stopProcessing="true"> | |
<match url=".*" /> | |
<conditions> | |
<add input="{ExampleRedirects:{REQUEST_URI}}" pattern="(.+)" /> | |
</conditions> | |
<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" /> | |
</rule> | |
</rules> | |
<rewriteMaps> | |
<rewriteMap name="ExampleRedirects"> | |
<add key="/some/page_product_51.html" value="Catalog/Category/Product/51" /> | |
<add key="/Home/Index" value="/" /> | |
</rewriteMap> | |
</rewriteMaps> | |
<!-- Redirect Based on query string --> | |
<rule name="Example_Validate_Query_String" stopProcessing="true"> | |
<match url="search$" /> | |
<conditions> | |
<add input="{QUERY_STRING}" pattern="^query=value$" /> | |
</conditions> | |
<action type="Redirect" url="/Results/{R:1}" appendQueryString="false" /> | |
</rule> | |
<!-- Redirect Based on host name --> | |
<rule name="Based on host name" stopProcessing="true"> | |
<match url="^path/sub path/page\.aspx$" /> | |
<conditions> | |
<add input="{HOST_NAME}" pattern="www.mydomain.net" /> | |
</conditions> | |
<action type="Redirect" url="http://www.mydomain.com/home/index" /> | |
</rule> |
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
<rewriteMaps> | |
</rewriteMaps> |
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
<rules> | |
</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
<system.webServer> | |
<rewrite> | |
<rules configSource="rewriteRules.config" /> | |
<rewriteMaps configSource="rewriteMaps.config" /> | |
</rewrite> | |
<!-- rest of your stuff --> | |
</system.webServer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment