IIS7 URL Rewriting Module Replace

iis, iis-7, regex, url-rewriting

Solution

There's no way to do directly what you want.

You might settle for something like this:

^(.*)%20(.*)%20(.*)%20(.*)  replaced by:  {R:1}-{R:2}-{R:3}-{R:4}
^(.*)%20(.*)%20(.*)         replaced by:  {R:1}-{R:2}-{R:3}
^(.*)%20(.*)                replaced by:  {R:1}-{R:2}

Problem

I really like the IIS7 URL rewriting module and so far, it worked great for me. There is one thing that I'm not sure how to do: I would like to permanently redirect all URLs that have encoded spaces (%20) in them to a URL that has the spaces replaced with a dash (-). So this: http://www.test.com/About%20Our%20Mission.aspx should be redirected to this: http://www.test.com/About-Our-Mission.aspx Is that even possible with only regular expressions?

Original source