-
Karl Scheirer: using RewriteMap
Posted on July 30th, 2010 No commentsThis is an Apache Directive that I've never had to use before, but it came in very handy for a very specific problem.
There was already an apache redirect (RewriteRule + RewriteCond) in place, but the destination URL was case sensitive! That's not normally a problem, but it was for an ad server, and the variables were coming in as uppercase, but needed to be lowercase after the redirect. Bad programming on the part of the ad server in my opinion, but we're not going to let that stop us! :)
RewriteMap to the rescue!
First off, the actual directive is a lot like a function definition, and it can only go in a config file or vhost, it's not allowed in a .htaccess file. Luckily the one we want to use is built in, so we just make it available with:
RewriteMap lc int:tolowerThis makes the "lc" function is available in our rewrite rules. We start off with the condition and basic rule ...


