We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Routing problem

Hello.

I'm setup multiple app and set this routes:

 // public route pattern
$router->add("/:module/:controller/:action/:params", array(
    "module" => 1,
    "controller" => 2,
    "action" => 3,
    "params" => 4
));

// custom route
$router->add("/people_zone/people/register-new-people", array(
    "module" => "people_zone",
    "controller" => "People",
    "action" => "registerForm"
));

$router->notFound(array(
    "controller" => "Error",
    "action" => "error404"
));

I want to implement this senario: have a public route pattern alongside custom routes, if route not match with public pattern the look for custom routes, but while i'm specified public pattern, custom routes are ignored.

In above case when i enter localhost/mybaseuri/people_zone/people/register-new-people the app say: "register-new-people action not found"

Reverse the order of the routes. The routes are checked in reverse order. http://docs.phalcon.io/en/latest/reference/routing.html#parameters-with-names (check paragraph right above the "Parameters with Names" heading)



15.3k

Thank you.