Register case insensitive on CodeIgniter?

I am using CodeIgniter for a web application, and now I have an urgent question: I just found that the URLs are case sensitive on Linux based servers, and I just moved the site from Windows to Linux. This means that links to the site no longer work when there are now all lowercase URLs that were not there before.

Googling I found that you can do something like this in a .htaccess file:

RewriteMap lc int:tolower RewriteCond %{REQUEST_URI} [AZ] RewriteRule (.*) ${lc:$1} [R=301,L] 

But I tried it, and it was not very good ...! Suddenly, I got a big ugly error page that looked at me saying that something was wrong with the Tomcat server or something like that. Needless to say, I immediately deleted these lines!

But why didn’t it work then, and what should I do instead?

Any help would be greatly appreciated.

+4
source share
2 answers

In fact, it turned out that it was quite easy, surprised that no one answered this (maybe this is not the right way, but I would have thought so ...):

I just added some routes in the routes.php file in the config folder:

$ route ['About / Contact'] = "about / contact";

And so on...

-1
source

The codebuster supports regular expressions - if you want to be explicit in defining your routes, define them so that they are not case sensitive:

 $route['(?i)(about\/contact)'] = 'about/contact'; 
+7
source

All Articles