Postcode url rewrite using IIS7 URL Rewrite not working

181 views Asked by At

I have just started using IIS7 and am setting up various URL rewrites. I am new to this so I may be making a novice mistake.

I am trying to rewrite a postcode so that I can have /KA71DR rewrite to /gis/property.asp?postcode=KA71DR

I have the following but it's not working:

<rule name="Postcode">
<match url="^/[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$" />
<action type="Rewrite" url="/gis/Property.aspx?postcode={R:0}" />
</rule>

The Test Pattern works. But when I try the page it returns a 404. Can anyone suggest what I am doing wrong?

1

There are 1 answers

0
Michael Byers On

Had to remove the leading slash and it worked.