Rewrite Rules (not) - Lowercase URLs, but only for some specific paths

This took me enough time to get right to post a little blog post about it:

        RewriteEngine on
        RewriteMap lc int:tolower
        RewriteCond %{REQUEST_URI} (shared|Shared|download|Download)/[A-Z]
        RewriteRule (.*) ${lc:$1} [R=301,L]

Note that this doesn't work in .htaccess - you have to put it higher up in the Apache configuration.