Gosh. I've never met mod_headers before-- and can't for the life of me figure out what RequestHeader is supposed to be for! (That is, if a process can read headers in the first place, why can't it read "^-?$" just as well as "none-bot"?)
SetEnvIfNoCase User-Agent
mod_setenvif has a useful shorthand just for user-agents:
BrowserMatch
BrowserMatchNoCase
I don't see how your code does what you say. (Although I hadn't realized that the difference between "-" and "" is "missing" vs. "empty".)
The form .+ captures one or more characters, including a single - or exactly the form you
don't want to catch. You could say .{2,} assuming no legitimate user-agent string will consist of only one character. If a robot really did come in introducing itself as "a", well, it deserves what it gets!
I would also suggest that for your own sake you should call the environmental variable something else. Anyone looking at the code-- including yourself in a few months' time--would say "No, that's backward, the form .+ means there
is a user-agent".
Can't you achieve the same thing in a single line using
RequestHeader edit
?
RequestHeader set|append|merge|add|unset|edit header [value] [replacement]
"value" here would be ^$ (empty) and/or ^-$ (missing), while "replacement" is "none-bot".