I would like to have your opinion and suggestion regarding the solution to this specific problem:
I have a rewritemap that takes care of a lot of vanity URLs, problem is, users may enter that vanity URL ending with a "/" or no "/", the matching does not occur in both cases, only one is matched, so I decided to create a rule first, that reduces the "/" then let the rewrite map take care of the matching... here is how it looks:
<rewrite>
<rules>
<rule name="ReduceLast" stopProcessing="true">
<match url="^.+(?=/+$)"/>
<action type="Redirect" url="{R:0}" redirectType="Permanent"/>
</rule>
<rule name="Redirect Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{StaticRedirects:{URL}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="False" redirectType="Permanent" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="StaticRedirects">
<add key="/australia/download" value="http://www.example.com/australia/trial-software.aspx" />
</rewriteMap>
</rewriteMaps>
</rewrite>