Case Insensitivity with .htaccess files

0 min read 130 words

If you have an .htaccess file to control the flow of URI’s on your site you may want to look at adding a nice little “case insensitive” feature to each line/item.

So an example of a line of .htaccess without any case insensitive bells and whistles looks like this:

RewriteRule ^AndrewOdendaal$ index.php?go=2964

We add our Case Insensitive feature by just adding a [NC] to the end of the line, like this:

RewriteRule ^AndrewOdendaal$ index.php?go=2964 [NC]

This is really handy when you have your site visitors typing things in themselves, as they love to add random CAPS where they like and without adding this it will just throw a 404 PAGE NOT FOUND error back at them.
So a really nice and easy way to get this working! I love Apache!

Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags