Welcome Guest, Not a member yet? Register   Sign In
Routes are conflicting with each other. Is it possible to set priority?
#1

Code:
$route['(:any)/(:any)/(:any)/(:any)'] = 'main/user/$1/$2/$3/$4';
$route['fetch/(:any)/(:num)/(:any)'] = 'fetch/$1/$2/$3';
$route['fetch/(:any)/(:any)/(:num)'] = 'fetch/$1/$2/$3';


Above is what I have in my routes.php

The route on the first line is making the below routes stop working. Any URL with fetch/apple/banana/123 will make the first line be followed instead of the third one.

Is it possible to set priority in routing, so if more than one rule is applicable, the rule that is above the other ones is what is used first?
Reply
#2

The priority are in what order you specify them. So place it in your priority order.

Code:
$route['fetch/(:any)/(:num)/(:any)'] = 'fetch/$1/$2/$3';
$route['fetch/(:any)/(:any)/(:num)'] = 'fetch/$1/$2/$3';
$route['(:any)/(:any)/(:any)/(:any)'] = 'main/user/$1/$2/$3/$4';
Reply




Theme © iAndrew 2016 - Forum software by © MyBB