CodeIgniter Forums
SOLVED: Ordering of the routers? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: SOLVED: Ordering of the routers? (/showthread.php?tid=23049)



SOLVED: Ordering of the routers? - El Forum - 09-28-2009

[eluser]jof[/eluser]
Hi

I have one question regarding the routing and ordering in the routers.php config file.

If I have an url like: http://domain.com/member/tom/archive

And two routing like this

Quote:$route['member/(:any)'] = "member/index/$1";
$route['member/(:any)/archive'] = "member/archive/$1";

The first router will grab my url and send it to "member/index/$1"
I want it to be sent to the second router "member/archive/$1" ??

Now I change the order of the routers thing suddenly work different?

Quote:$route['member/(:any)/archive'] = "member/archive/$1";
$route['member/(:any)'] = "member/index/$1";

Does CI routers allways send the request to the FIST possible match, even if there is a "better" later in the routers.php file?

Or am I totally doing things wrong here?

regards / Johannes