HELP - Using Routes.php to turn all paths into parameters. |
[eluser]orokusaki[/eluser]
Hi, so what I'm trying to do is bypass all controller / function segments in the URL so that I can have: http://site.com/param1/param2/param3 ... and so on I have: Code: $route[':any'] = "controller_1/function_1"; and it works fine... except: If have another controller controller_2, and I go to http://site.com/controller_2/ it accesses controller_1 and sets the param1 as "controller_2" instead of accessing controller_2 How do I use all segments of the URI as params for a single function, with a condition that if the first segment is a controller it uses that controller instead of passing it as a param? P.S. I am setting the custom route after the reserved routes.
[eluser]Jelmer[/eluser]
You should declare a route for every url other than those for the wildcard before the wildcard rule (:any). like this: Code: $route['controller_2'] = "controller_2";
[eluser]orokusaki[/eluser]
Awesome thanks. I didn't think anything like that would work. Will try it tonight. |
Welcome Guest, Not a member yet? Register Sign In |