Can IIRF rewrite this rule?

Topics: Developer Forum, Project Management Forum, User Forum
Apr 14, 2007 at 5:23 PM
Hi all, just came across IIRF a few minutes ago, and read all the documentation with great pleasure, finaly a great rewrite ISAPI for IIS that is free, thanks for that.

I have specific needs however, and before I get my hands dirty (which I'm eager for) let me ask the community if IIRF can transform this:

My CMS currently writes this types of URLs;


Lets look at this one in particular;


Can IIRF transform it to;


The first querystring is always the module to use, the second is the action, and the third and last is the title or id of the page/product/whatever, can this be achieved?

Note that there is never a filename in the URL, it always processes default.asp or aspx.

What would be the rule for it?

Apr 14, 2007 at 8:10 PM

Yep...anything's possible in the world of magic! (ha, ha, ha)

Fairly easy rewrite.

You'd do something like this:

  1. for urls with Page Id
RewriteRule ^/(\w)/(\w)/(1-9+)(?:/?)$ /?module=$1&action=$2&pageId=$3

  1. for uls with Page Title
RewriteRule ^/(\w)/(\w)/(\w)(?:/?)$ /?module=$1&action=$2&pageTitle=$3

For reference, the (?:/?) rules says it doesn't matter if you find a trailing "/" or not; so if someone types in "" it'll still rewrite just as if they typed in ""

I'm not in front of my dev machine to check out my rules but it should get you close.

I'd highly recommend you download Expresso (freeware RegEx application - write and test expressions - very handy if you're not familiar with RegEx). Also utilize the TestDriver.exe and throw some sample URLs at it with the SampleURL.ini file to see if they do indeed rewrite.

Apr 14, 2007 at 9:19 PM
Thanks, this is good news, I will put this to the test tomorrow.

I am fairly familiar with RegEx, not an expert, but I think your expressions might just do it.

Will let you know soon, in the mean time if you have further input, let me know.

Thanks once again.