0
votes

I am using IIS 7.5 and URL Rewrite 2.0, and am trying to create a rule that will rewrite a URL like…

http://www.abcd.com/2576-River-Oak-Drive/SF/3567781

to….

http://www.abcd.com/search/propDetail.cfm?TYP=SF&LN=3567781

basically ignoring the “2576-River-Oak-Drive” component.

After setting up a rewrite rule, my web.config file, which is located at the site root (d:\sites\abcd\web.config), contains the following section…

<rewrite>
  <rules>
    <rule name="Rewrite to propDetail.cfm" patternSyntax="ECMAScript" stopProcessing="true">
     <match url="^/([_0-9a-z-]+)/([A-Z]{2})/([0-9]+)" ignoreCase="true" />
     <action type="Rewrite" url="propDetail.cfm?TYP={R:2}&amp;LN={R:3}" appendQueryString="true" logRewrittenUrl="false" />
     <conditions>
        <add input="{HTTP_HOST}" pattern="^www\.abcd\.com$" />
     </conditions>
   </rule>
  </rules>
</rewrite>

When I point a browser to http://www.abcd.com/2576-River-Oak-Drive/SF/3567781, I get a 404 error and message which says that directory d:\sites\abcd\2576-River-Oak-Drive\SF\3567781 doesn’t exist on the server.

I assume the 404 error and message mean that the rule never fired. Is that correct and if so, what error is causing the rule not to fire?

1

1 Answers

0
votes

Found the problem. The match URL should not contain the leading "/"; should have been "^([_0-9a-z-]+)/([A-Z]{2})/([0-9]+)".