Using mod_rewrite, how do I force the path and query string to be lowercase?
It seems like it should be easy, but for me life I cannot understand.
I want my entire url to be in lowercase, so for example:
http://www.EXAMPLE.com/foo?q=bar
http://www.example.com/FOO?q=bar
http://www.example.com/foo?Q=BAR
http://www.EXAMPLE.com/FOO?Q=BAR
all (301) redirect to:
http://www.example.com/foo?q=bar
Adding:
RewriteMap lc int:tolower
in httpd.conf and:
RewriteEngine on
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [L,R=301]
to.htaccess, I can make the base url portion redirected the way I want (the first two cases above), but I cannot figure out how to make this work for the query string. Can anyone point me to how to do this?
+2
source to share