Codeigniter Routing Unlimited Paramaters Codeigniter Routing Unlimited Paramaters codeigniter codeigniter

Codeigniter Routing Unlimited Paramaters


Try this:

$route['api/([^/]*)/([^/]*)/(.*)'] = '$1/api_$2/$3';

It basically checks for two segments (any character but a slash), then anything after that gets appended as parameters to your controller function.

This wouldn't match for routes with NO parameters, but it's not hard to do if that's a case you need to handle.


This Works perfectly,

$route['api/(.*)']='api/$1';


I believe just this would do:

$route['api/(:any)/(:any)'] = '$1/api_$2';$route['api/(:any)/(:any)/(:any)'] = '$1/api_$2/$3';