Correct for both your analysis of the back-reference variables and your question about the test-string. To determine back-reference variable numbers, count the left parentheses.
You can use back-references only in the test-string on the left side of a RewriteCond, and not in the pattern on the right.
Also, be aware that if you use the "Referer is NOT" construct, you must make provisions in the logic so that the code behaves correctly when the referer is blank, which it will be quite often, even for legitimate requests.
Jim
[edited by: jdMorgan at 4:34 pm (utc) on Aug. 2, 2007]