OK I wrote up some rewrite rules on one of our test servers and found that they worked fine. I then moved these rules to our live server and found that they caused endless loops. After much playing around I found that if I created a directory with the same name as the first matching element of my rules they would start working. What is odd though is that on the test server this was not required yet on the live server it was. They are both the same version of apache compilled almost identically.
Anyway here is an example of what I am talking about:
RewriteRule agency/(.*)-(.*)-([0-9]+)\.html http://www.test.com/newdir/$2.php?xc=$3 [L]
On the one server this works great, on the other server it does the loop. Any ideas?