I've written this in the CodeIgniter's routers.
$route['companyname'] = "/profile/1";
This is working fine but when I type "CompanyName" into the URL then it doesn't work. This is because upper case characters.
I want to make this routing case insensitive. Please suggest the best way.
Just add expression "(?i)"
Here example: $route['(?i)companyname'] = "/profile/1";
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. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With