Welcome Guest, Not a member yet? Register   Sign In
Forcing lower case controller names
#1

[eluser]liquid_t[/eluser]
I just stumbled upon a problem with my site were people are linking to pages with the controller name in caps and getting 404 pages..not good Sad

For instance www.domain.com/contact is fine. www.domain.com/CONTACT is not. also I think this only happens with controller names. Not controller functions or their parameters.

So the question is: Can I force lowercase with routing or htaccess ... or something?

Thanks a lot!
#2

[eluser]Mirage[/eluser]
I think this may have to do with your hosting filesystem being case sensitive. I develop on OSX/hfs and it is not. In the past I hosted on XServe so it was never a problem until I moved hosting to Linux and stuff started being a problem. I ended extending the Loader (and maybe some related classes) to relax the CI enforced naming rules. The only rule is now: You call it what you name it.
#3

[eluser]Dam1an[/eluser]
One way around this (which I havn't tested, so may not work, but is worth a try, is creating a rule in config/routes.php for any uppercase string, something like
$route['([A-Za-z0-9]*)/('] = "strtolower($1)";

This should match any controller name which has upper case characters in it, and convert it to lowercase

Let me know if it works




Theme © iAndrew 2016 - Forum software by © MyBB