Reputation: 1694
This is my routes setup code
$route['general/(:any)'] = "videos/filter/$1/1";
$route['general/(:any)/(:num)'] = "videos/filter/$1/1/$2"; //pagination
Following link works fine.
www.example.com/general/latest
But below link doesn't work like what i want
www.example.com/general/latest-trending/5
$route['general/(:any)'] only executes always.
How to solve this issue?
Upvotes: 1
Views: 140
Reputation: 4565
Reverse the order:
$route['general/(:any)/(:num)'] = "videos/filter/$1/1/$2"; //pagination
$route['general/(:any)'] = "videos/filter/$1/1";
You want more specific routes first, because if the shorter one matches first, it will ignore all other routes.
Upvotes: 4