CodeIgniter Forums
Override :any routes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Override :any routes (/thread-32819.html)



Override :any routes - El Forum - 08-05-2010

[eluser]GeXus[/eluser]
I have a route setup for '/page/:any'

I'd like to override it, only if the proceeding value is 'lp', so for example
'/page/lp/:any'

This doesn't seem to work though... Any ideas if there's a better way to override it for certain cases?


Override :any routes - El Forum - 08-05-2010

[eluser]Jelmer[/eluser]
Routing rules are processed in the order in which you put them. It's not "best fit" it's "first match". So if your :any rule already matched the page/lp, that second "override" rule will never be processed.
Always put the more specific rule (‘/page/lp/:any') before the more general rule (‘/page/:any').


Override :any routes - El Forum - 08-05-2010

[eluser]GeXus[/eluser]
Ahh I had it reversed.. thank you! Smile