1

I have this URL www.example.com/music/in/chicago

And none of the rewrite rules in placed in my rewriteRules.config below match the above URL....what am I missing?

<rules>
<clear />
<rule name="music search city hardcode">
  <match url="^/music/in/chicago"/>
  <action type="Rewrite" url="contact.aspx"/>
</rule>
<rule name="music search city">
  <match url="^/music/in/([a-zA-Z-+.']+)"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>

<rule name="music search city 2">
  <match url="^\/music\/in\/([a-zA-Z-+.']+)"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>

<rule name="music search city 3">
  <match url="^/music/in/([a-zA-Z-+.']+)"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>

<rule name="music search city 4">
  <match url="^\/music\/in\/([a-zA-Z-+.']+)$"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>

<rule name="music search city 5">
  <match url="^music/in/([a-zA-Z\-+.']+)$"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>

<rule name="music search city 6">
  <match url="^music\/in\/([a-zA-Z-+.']+)$"/>
  <action type="Rewrite" url="search.aspx?cityurl={R:1}&amp;t=2"/>
</rule>   

<rule name="final rule">
  <match url="^(fornitori|vendors)/(musica|music)/c/([a-zA-Z0-9-+']+)/([a-zA-Z0-9-+']+)/([a-zA-Z0-9-+' ]+)$"/>
  <action type="Rewrite" url="search.aspx?countryurl={R:3}&amp;provinceurl={R:4}&amp;cityurl={R:5}&amp;t=2" appendQueryString="true"/>
</rule>

</rules>

update

I added rule hardcode to redirect to a different page and even that does not work...I'm really confused now

  • Where is your Web.config file? Assuming in the document root then I would have expected rule #5 to match, except the hyphen (-) after the Z should really be backslash escaped to match a literal hyphen. – MrWhite Nov 29 '15 at 22:48
  • @w3d thanks! I changed my post with rules locations and your suggestion...but with that added, still there's no match on rule #5 and the weird thing is that rule final rule seems to be triggered – Flo Nov 29 '15 at 22:57
1

Turns out Chrome was caching my requests! I found this out when running Chrome in incognito mode. I now start Chrome with parameter --disk-cache-dir=null, so: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disk-cache-dir=null.

  • 1
    You can also test with the Object Inspector open and check the "Disable Cache" option on the Network tab. – MrWhite Nov 30 '15 at 10:19
  • @w3d Ah, even better :) – Flo Nov 30 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.