I currently have this in my CodeIgniter routes file. It maps anything with a URI api/controller/function to controller/api_function.
api/controller/function
controller/api_function
I believe just this would do:
$route['api/(:any)/(:any)'] = '$1/api_$2'; $route['api/(:any)/(:any)/(:any)'] = '$1/api_$2/$3';