I'm wondering if it is possible to have an IIS7 URL rewrite rule that does something like this. When someone goes to:
http://www.mydomain.com/images/0000022_0-Hello_World.jpeg
it will request the file at: http://www.mydomain.com/images/0000022_0.jpeg
I tried to make a rule to match (.)/images/(.)-(.*).jpeg and then rewrite it to {R:1}/images/{R:2}.jpeg, but it doesn't work. I just get a 404 error. I also tried adding the ISAPI Wildcard, but it didn't change anything.
I'm using .net 4.0
Thanks!
Assuming you use IIS Manager ( like in this article):
Try to create a rewrite rule which matches the following pattern (regular expressions):
^images/([0-9_]+)-.*\.jpeg$
As Action, choose rewrite, and fill in the following rewrite Url:
images/{R:1}.jpeg
No other rule should be executed after that (-> Stop processing of subsequent rules checkbox)