Reputation: 163
Need a quick hand on setting custom route for my project.
the code works without any reoute definition as
http://myblog.local/posts/categories/show/1
but I want to access it as following;
http://myblog.local/posts/1
and I've changed my route as following;
$route['posts/(:any)'] = 'posts/categories/show/$3';
But my route declaration seems not working, please help me where i am doing the mistake
Upvotes: 0
Views: 41
Reputation: 163
$route['posts/(:num)'] = 'posts/categories/show/$1';
also in config file make it blank $config['index_page']='';
hope this might work.
Upvotes: 1
Reputation: 3740
$route['posts/(:num)'] = 'posts/categories/show/$1';
Because you have only 1 segment (the first) to match: $1
And the segment must be a number: (:num)
(:any) will work too.
Upvotes: 1