---- mod rewrite issue where directory actually exists
lucy24 - 9:46 pm on Jan 19, 2013 (gmt 0)
I did change the conditional as follows which seems to avert the error
You got it :)
In mod_rewrite, the space itself has meaning. "First piece of rule", space, "second piece", space, and so on. So if you need to use a space as a literal character-- most often in conditions involving THE_REQUEST, like here-- you have to escape it. When you look at your code you'll notice that you did this automatically in the other two places in the same line, but left it out of the grouping brackets. It's an easy oversight, since most things in brackets don't need to be escaped. (Other exceptions are literal brackets, hyphens and carets.) But mod_rewrite syntax overrides RegEx syntax, so the space counts as punctuation. And this in turn means that mod_rewrite thinks it's meeting an orphaned flag-closing bracket without the preceding opening bracket plus flag of some kind. That's where the error message comes from.
I think mod_rewrite-- and possibly everything else in Apache-- simply ignores trailing spaces. That's why you can't use \ (escaped literal space) as the very last character in a line. I tried it once. Ouch.
The only thing I can see is an extra newline character on my last line
Huh, that's funny, the significant change was that I deleted one blank line. But that's because you already had blank lines before each rule. More often, people have to be urged to add them. Separate the rules, but keep each condition(s)-plus-rule package together.