Wondering how to make URLs case insensitive in Apache? I was too. Below are a few simple steps and code (that worked for me) when needing to accomplish this task. The code listed can be added to your .htaccess file.
1. Create a rewrite map called lc. ’lc’ would be defined using an internal ‘tolower’ map.
2. A rewrite conditional rule would be used so that only URLs containing upper case characters are rewritten and processed.
3. The actual rewrite rule is defined using the lc rewrite to modify the requested/captured URL to lower case before initiating a 301 redirect for the user.
So if we were to code it out, it would look something like this:
RewriteEngine On
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
4. Then add the code to your .htaccess. Make sure to remove any 301s in case you need to do some troubleshooting.
All in all, character case would not matter if we implemented this system because we are stating we only want lower case URLs. Anything other than that would be rewritten and redirected. Now remember, doing this will also cause all links to be processed. Meaning your links will all be redirected. This is a fault in the logic.
And that’s it. No more character case issues on Apache.
*I take no responsibility for you fucking up your site/server/SEO. Enter this at your own risk. If you get the five-oh-oh… you know something is wrong. Try, try again.