Overlapping swa because I detoured to look up some stuff.
Yup, that's a query string. And I guess you're stuck with the slashes :)
Since your de-capitalization is concerned only with your own URLs, there should be no need for your off-site redirect page to get involved. It may even create errors if you're changing the capitalization of some other site's page names.
But at this point it's no longer an html question but some combination of-- probably-- php and apache.
The quickest temporary fix is to put an exclusion in your redirect code that skips anything in the form %\h\h (expanded to [\dA-F] or even [0-9A-F] if your RegEx dialect doesn't do \h). Exact mechanics will again depend on the exact form of the redirecting function.