I am working with an mvc4 applciation running in IIS 7.5 and I am having trouble with rewrite rules I have set up. The following is my section from the web.config.
<rewrite>
<rules>
<rule name="RewriteImage">
<match url="/myassets/([_0-9a-z-]+)/images/category/([_0-9]+)-([_0-9a-z-]+)-([0-9]+)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/myassets/{R:1}/images/category/cat_{R:2}_{R:4}_{R:3}.jpg" />
</rule>
</rules>
</rewrite>
What I want to do in above url rewrite images to another path.
I supply the following url https://localhost/myassets/en-uk/images/category/123456-5x10-1_my+image+description.jpg
and expect it to rewrite to https://localhost/myassets/en-uk/images/category/cat_123456_1_5x10.jpg
but it doesn't.
When I test it in IIS, all works fine, but via the browser the rule never kicks in. I am looking for suggestions as to where I am gone wrong as this is becoming very frustrating!
This is the only rule I have, I tried a simple redirect rule which redirects uppercase url's to lower case urls and this works fine.
One thing I did notice in my web.config, the first rewrite tag has a blue squiggly under saying it its not recognised section of system.webserver.
Application is running in integrated mode.
https://localhost/myassets/en-uk/images/category/cat_123456_1_5x10.jpg
exist? – cheesemacfly<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
? – cheesemacflyhttps://localhost/myassets/en-uk/images/category/cat_123456_1_5x10.jpg
exists and when you callhttps://localhost/myassets/en-uk/images/category/123456-5x10-1_my+image+description.jpg
it doesn't display it, right? What do see instead? What if you use the Failed Request Tracing tool? – cheesemacfly