-
Notifications
You must be signed in to change notification settings - Fork 35
/
IISUrlRewrite.xml
33 lines (30 loc) · 1.51 KB
/
IISUrlRewrite.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<rewrite>
<rules>
<!-- Example of a redirect to a non-www domain in production -->
<!-- This example can be easily changed to redirect to a www domain as well -->
<rule name="Redirect to non-www domain" stopProcessing="true">
<match url="(.*)" />
<conditions>
<!-- Ignore your local dev host -->
<add input="{HTTP_HOST}" negate="true" pattern="localhost" />
<!-- Ignore your preview/staging websites -->
<add input="{HTTP_HOST}" negate="true" pattern="preview.example.com" />
<!-- Make sure to ignore your own domain to prevent a redirect loop -->
<add input="{HTTP_HOST}" negate="true" pattern="^example.com" />
</conditions>
<!-- TODO: Change all occurrences of "example.com" to match your production website -->
<action type="Redirect" url="http://example.com" />
</rule>
<!-- Example of 301 permanent redirect using Regex patter -->
<rule name="Regex pattern" stopProcessing="true">
<match url="^rewrite/(.*)" />
<action type="Redirect" url="?rewrittenFrom={R:1}" appendQueryString="false" redirectType="Permanent" />
</rule>
<!-- Example of 301 redirect using transition from old to new url -->
<!-- NOTE: This is a workaround for no support of Rewrite Maps in ASP.NET Core 1.1 -->
<rule name="/oldUrl->/newUrl" stopProcessing="true">
<match url="^oldUrl[/]$" />
<action type="Redirect" url="/newUrl" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>