Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!-- Redirect to HTTPS -->
<rule name="HTTPS_AlwaysOn" patternSyntax="Wildcard" stopProcessing="false">
<match url="*" />
<set name="HTTPS" value="on" />
<action type="None" />
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" />
<!-- 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" />
<!-- 301 Redirect that uses a rewrite map -->
<rule name="Example_Rewrite" stopProcessing="true">
<match url=".*" />
<add input="{ExampleRedirects:{REQUEST_URI}}" pattern="(.+)" />
<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
<rewriteMap name="ExampleRedirects">
<add key="/some/page_product_51.html" value="Catalog/Category/Product/51" />
<add key="/Home/Index" value="/" />
<!-- Redirect Based on query string -->
<rule name="Example_Validate_Query_String" stopProcessing="true">
<match url="search$" />
<add input="{QUERY_STRING}" pattern="^query=value$" />
<action type="Redirect" url="/Results/{R:1}" appendQueryString="false" />
<!-- Redirect Based on host name -->
<rule name="Based on host name" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<add input="{HOST_NAME}" pattern="" />
<action type="Redirect" url="" />
<rules configSource="rewriteRules.config" />
<rewriteMaps configSource="rewriteMaps.config" />
<!-- rest of your stuff -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.