Convert to lowercase in a mod_rewrite rule

First, put the following line in the <VirtualHost> section of your .conf file.
(For me that lives at /etc/httpd/vhosts.d/00foo.conf.)

RewriteMap lc int:tolower 

You can replace lc with any name you want.
Then restart apache, which you can do with sudo service httpd restart.

Finally, add this in your .htaccess file:

RewriteRule ^/(.*)$ /${lc:$1} 

Leave a Comment