Welcome Guest, Not a member yet? Register   Sign In
Routes issues
#1

[eluser]Matty[/eluser]
Hi I for some reason can't get this 1 url to work and was wondering if anyone could help out.

My routes are as follows....
Code:
$route['default_controller'] = "master";
$route['(:any)'] = 'master';
$route['404_override'] = '';

//Admin controller routes
$route['admin'] = 'admin/ADMIN';
$route['admin/(:num)'] = 'admin/ADMIN/user';

//CMS controller routes
$route['cms'] = 'cms/CMS';
$route['cms/control_panel'] = 'cms/CMS';
//$route['cms/admin'] = 'cms/CMS/admin';
$route['cms/website_info'] = 'cms/CMS/website_info';

//CMS Pages controller routes
$route['cms/pages'] = 'cms/CMS_pages';
$route['cms/pages/(:num)'] = 'cms/CMS_pages';

Everything works apart from the admin user route ($route['admin/(:num)'] = 'admin/ADMIN/user'Wink

Any ideas would be greatly appreciated.

M
#2

[eluser]meigwilym[/eluser]
Does it not work at all, or does not work as you would expect?

Mei
#3

[eluser]CroNiX[/eluser]
Your rules are all in the wrong order.
Routes get processed from the top down and stop as soon as there is a match. Routes should be ordered from the most specific (most segments) to the least. Your catch all route, (:any) should be dead last, as it will process any route at all, so you want the specific routes before this route.

These, and the others, are backwards. The routes that have 2 segments should come before those that have one.
Code:
$route['cms'] = 'cms/CMS';
$route['cms/control_panel'] = 'cms/CMS';
//$route['cms/admin'] = 'cms/CMS/admin';
$route['cms/website_info'] = 'cms/CMS/website_info';




Theme © iAndrew 2016 - Forum software by © MyBB