RedirectBase together with R=301 condition

Feb 10, 2010 at 4:34 PM

I've been looking into the rewriter module a bit today, but there is something I can't seem to figure out. When I host my web application in IIS (5 to be exact on an XP system) and use the following configuration:

RewriteEngine On
RewriteBase /Rewriter
RewriteRule ^/article/(.*)/(.*).aspx /default.aspx?articleid=$2 [NC,R=301]
RewriteRule ^/article/(\d+).aspx /default.aspx?articleid=$1 [NC,R=301]

Based on the mod_rewrite documentation (, more specifically, based on the description of the RewriteBase directive, I would have thought that requesting the url: http://localhost/Rewriter/article/123.aspx would redirect to http://localhost/Rewriter/default.aspx?articleid=123. This isn't the case however. The redirection is actually to http://localhost/default.aspx?articleid=123.

After stepping into the code, I noticed that in the RuleSet class the flags are being applied when you are able to execute a rule (in the method RunRules):

var flagResponse = temporyFlags.Apply(ruleContext);

When encountering a redirect flag it immediatelly redirects.  Because the redict already happened, this also means that the code to add the base again is not being executed.

Now my question, is this behavior by design? 

(PS The code base I evaluated was the change set 45203.)

Feb 10, 2010 at 7:13 PM

The code uploaded isn't the latest source code.  Do you have the same issue on Release 3.5?