I\'ve written this in the CodeIgniter\'s routers.
$route[\'companyname\'] = \"/profile/1\";
This is working fine but when I type \"CompanyN
Uhm, well, an dirty but straight to the point way would be to make a small hack to the core Uri class. Open the uri.php
file inside system/core/
, scroll to line 269 where you have the method _explode_segments()
and make them lowercase. Bad method, but should work.
function _explode_segments()
{
foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val)
{
// Filter segments for security
$val = trim($this->_filter_uri($val));
if ($val != '')
{
// $this->segments[] = $val; // <--- ORIGINAL
$this->segments[] = strtolower($val); // <--- CHANGED
}
}
}
Just consider that if you upgrade your install this changes will be overwritten, but they're so small anyway. Alternatively, you might go for a pre_system hook, but I think it would be much more difficult
Also, in routes you should not use leading or trailing slashes, so it must be
$route['companyname'] = "profile/1";