//config/routes.php
$route[':any/(:any)/(\d+)'] = "startup/subcategory/$1/$2";
$route[':any/(:any)/(:any)'] = "startup/subcategory_post/$1/$2";
$route['(:any)/(\d+)'] = "startup/category/$1/$2";
$route[':any/(:any)'] = "startup/category_post/$1";
//controllers/startup.php
class Startup extends CI_Controller{
public function category_post($post)
{
echo 'category_post '.$post;
}
public function category($cat,$page)
{
echo 'category '.$cat.' '.$page;
}
public function subcategory_post($subcat,$post)
{
echo 'subcategory_post '.$subcat.' '.$post;
}
public function subcategory($cat,$page)
{
echo 'subcategory '.$cat.' '.$page;
}
}