Aug 8, 2011 at 12:28 AM
Edited Aug 8, 2011 at 12:33 AM
The RewriteRule directive accepts 2 required arguments (a url pattern and a replacement string), followed by an optional set of modifiers.
You have provided only a single argument to RewriteRule, followed by a modifier. Well, actually IIRF parses by position, so it will parse your RewriteRule as - for the url pattern, and [F] for the replacement string, which is not your intent, I believe.
I am assuming the [F] is intended to be a modifier, but IIRF won't detect that intention.
It's sort of dumb, because when you use the [F] modifier, the replacement string is not used. It's ignored, irrelevant. But the syntax is a holdover from Apache, and that is the way Apache mod_rewrite does it. So even though
the value of the 2nd argument, the replacement string, is irrelevant, the presence of the 2nd argument is required. It would be clearer to just have a unique directive, "Forbid", and it accepts a single argument, a url pattern. But... IIRF
doesn't support the "Forbid" directive right now, so you're stuck with the apache-style syntax.
Also: I think you do not want that RewriteCond. RewriteRule uses the test pattern against the incoming URL. In other words, RewriteRule has a built in "condition" - the rule applies only if the pattern matches the original requested
So normally you would do something like this:
RewriteRule ^/exchange notused [F]
(no RewriteCond necessary) This says, if the URL matches, then respond with 403 Forbidden.
The pattern ^/exchange matches all of these incoming URLs:
That's because the regex pattern doesn't insist on an ending to the string. The regex begins with ^ , which implies beginning-of-line. In english it evaluates to "the url starts with /exchange". The pattern doesn't stipulate that anything must
follow /exchange, and maybe you don't care. If you want to be more strict you could do something like this:
RewriteRule ^/exchange($|/) notused [F]
which stipulates that following the word "exchange" in the incoming URL must be the end-of-line, or a slash. It matches these:
but not these: