While moving some of our download URLs to Amazon’s S3 service we came across the problem, that some of the URLs out there use mixed case (which was no problem with our windows servers, they ignore uppercase/lowercase in URLs) while Amazon’s S3 is case senitive.
We needed to rewrite all our URLs to lower case before redirecting the downloads to S3.
Here is the trick:
RewriteMap lowercase int:tolower
RewriteRule ^/download/(.*) http://your-bucket-at-amazon.domain/download/${lowercase:$1} [L,NC]