I (think I) understand what the problem is now.
Pattern is a perl compatible
regular expression. On the first RewriteRule, it is matched against the (%-decoded)
file-path, depending on the context) of the request. Subsequent patterns are matched against the output of the last matching RewriteRule.
What is matched?
VirtualHost context, The
Pattern will initially be matched against the part of the URL after the hostname and port, and
before the query string (e.g. "/app1/index.html").
Directory and htaccess context, the
Pattern will initially be matched against the filesystem path, after removing the prefix that led the server to the current
RewriteRule (e.g. "app1/index.html" or "index.html" depending on where the directives are defined).
As I come to understand this, it means that the RewriteRule-pattern should never match the query string (but it can be appended via the QSA-modifier).
Unfortunately, this would mean a drastic change in IIRF if you were to make it fully compatible (and if my explanation is correct), but debating on how to achieve/fix the issue is (as it seems) a complete new issue. There are many possible 'quick fix'-solutions
to this problem (if I am correct about the problem), but a full-compatibility-change might be too much for people depending on how it currently works.