Created attachment 31627 [details] Improve error reporting in mod_rewrite The parser in mod_rewrite always interprets the third argument to RewriteRule/RewriteCond as optional flags. However, unescaped whitespace is fairly easy to accidentally insert into a RewriteRule/RewriteCond directive. When this happens, "bad flag delimiters" is displayed since the rogue whitespace causes the parser to interpret a chunk of one of the args as flags. This error is a spectacularly bad way to express this (even if it's strictly true). The attached patch attempts to improve the error reporting of the relevant section in mod_rewrite.
This seems to trigger on: RewriteRule .* - [G] RewriteRule: bad flag delimiters: third argument must end with ']' but found [G] - unintended whitespace within the flags definition? (pattern='.*', substitution='-', flags='[G]')
Created attachment 31685 [details] Improve error reporting in mod_rewrite Silly of me - forgot my order of operations.
Thanks, committed to trunk in r1652507. (reminded of this patch by my own whitespace typo in RewriteCond)