2

I am redirecting URL in the config file. This is what I am doing:

<rule name="award temp redirect"  stopProcessing="true">
    <match url="(.*?)/?award.aspx$" />
    <action type="Redirect" url="http://www.abc.com.au/award.aspx" redirectType="Temporary" />
</rule>

This is working fine for /award.aspx but I want to add for /awards or /award as well. Currently I have create separate rules for /awards or /award.

Can I add these two into one match. If the Url is /award.aspx or /award or /awards then redirect to http://www.abc.com.au/award.aspx.

lorond
  • 3,856
  • 2
  • 37
  • 52
Owais Ahmed
  • 1,364
  • 1
  • 30
  • 62

1 Answers1

3

match accept regex for url value. Try:

<match url="(.*?)/?awards?(\.aspx)?$" />

Regular expression visualization

This will match award, award.aspx, awards and awards.aspx.

Update to match /test as well:

<match url="(.*?)/?(awards?|test)(\.aspx)?$" />

Regular expression visualization

It is just a regular expression. You can match whatever you want.

lorond
  • 3,856
  • 2
  • 37
  • 52