CodeIgniter Forums

Full Version: Possible fix for not working default_controller route
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I was really frustrated because default_controller did not work as expected. What fixed it for me was to remove an apparently faulty call to strtolower in system/core/Router.php in the second option of the ternary that checks for the a valid default_controller value.

I have found some other discussions on related topics, some even mentioned the problem of controller names being converted to lowercase. Be aware that I am using

$config['uri_protocol'] = "REQUEST_URI";

instead of "AUTO", which also seems to have difficulties.

If your installation also does not react to the default controller if you call simply call

try changing this in the system/core/Router.php

Original code (line 96):
$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);


$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : $this->routes['default_controller'];

Hope this saves some trouble for other people having the same problem. If the error is on my side and I failed to understand the docs or scheme of the uri routing please let me know.



El Forum

Hi, it's my first message.

I have the same problem beause we work local on windows and the remote server have linux.

If you set the controller name with camelcase and the file, in windows works , but not in linux because have a case sensitive file system.

Sorry for me bad english Wink.