Dynamic routes in codeigniter

141 Views Asked by At

How to write custom routes in codeigniter?

$route['codeigniter/getAllCategories'] = "codeigniter/category_controller/getAllCategories";
$route['default_controller'] = "admin";
$route['404_override'] = '';
http://localhost/codeigniter/category_controller/getAllCategories
$route['(:any)/(:any)'] = 'category_controller/$1/$2';
1

There are 1 best solutions below

0
Niranjan N Raju On

Instead of what you are doing , you can do the concept of slug in codeigniter to create dynamic routes. Check this link. http://osvaldas.info/smart-database-driven-routing-in-codeigniter