My answer is a bit like Colin's.
When I played with routes in CodeIgniter, I came to the conclusion that the order of the routes is important. When it finds the first valid route, it will not follow other routes in the list. If it does not find valid routes, it will handle the default route.
My routes that I played with my specific project worked as follows:
$route['default_controller'] = "main";
$route['main/:any'] = "main";
$route['events/:any'] = "main/events";
$route['search/:any'] = "main/search";
$route['events'] = "main/events";
$route['search'] = "main/search";
$route[':any'] = "main";
" http://localhost/index.php/search/1234/4321" main/search, $this->uri->segment(2); 1234.
( ):
$route['products/:any/:any'] = "products/getProductByName";
$route['products/:any'] = "products/getCategoryByName";
, , (products/$1/getProductByName/$2), , URI. $this->uri->segment(n);, Colin , , .