I\'ve written this in the CodeIgniter\'s routers.
$route[\'companyname\'] = \"/profile/1\";
This is working fine but when I type \"CompanyN
Use hooks:
Create application/hooks/LowerUrl.php
class LowerUrl {
public function run() {
$_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
}
}
Add to application/config/hooks.php
$hook['pre_system'] = array(
'class' => 'LowerUrl',
'function' => 'run',
'filename' => 'LowerUrl.php',
'filepath' => 'hooks'
);
If you want case-insensitive routing for all routes, you just need to extend CI_Router class, then modify _parse_routes() method like this:
public function _parse_routes()
{
foreach ($this->uri->segments as &$segment)
{
$segment = strtolower($segment);
}
return parent::_parse_routes();
}
It will be cleaner than editing the CI_URI class itself. :)