CodeIgniter Forums
Routing Q. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Routing Q. (/showthread.php?tid=29889)



Routing Q. - El Forum - 04-25-2010

[eluser]RobertB.[/eluser]
Hello to all,
I'm having problem with the routing system.

This works flawless if I used the table id(numbers).

Code:
$route['(:num)'] = "listings/subcats/$1";
$route['category/(:num)'] = "listings/states/$1";

But if I try to use a permalink field that I have on the table and change the routing to this only the first one works the second one does not take me to listings/states/ but instead takes me to listings/subcats/ again and obviously it give me the Message: Invalid argument supplied for foreach().

Code:
$route['(:any)'] = "listings/subcats/$1";
$route['category/(:any)'] = "listings/states/$1";
Can anyone explain this?

Thanks


Routing Q. - El Forum - 04-25-2010

[eluser]Aken[/eluser]
Specific rules should go first, catch-all rules go at the end. CodeIgniter will go through your routes in succession until it finds one that matches. (:any) will obviously match anything, and will stop at that point and redirect accordingly.


Routing Q. - El Forum - 04-25-2010

[eluser]RobertB.[/eluser]
Thanks,
That was it.