We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Routing error on specific route

I have created a routing to my site, and works perfectly on this way

//WORKS

    $router = new Router();

    //App Route
    $router->add(
        '/online/{slug}',
        array(
            'controller'    =>  'application',
            'action'        =>  'app',
            'slug'          =>  1,
        ));

    //Category Route
    $router->add(
      '/categoria/{slug_category}/{current_page}',
      array(
          'controller'        =>  'category',
          'action'            =>  'apps',
          'slug_category'     =>  1,
          'current_page'      =>  2,
    ));

    return $router;
});
https://mysite.com/online/app_name  //OK
https://mysite.com/categoria/name_category //OK

But, when i decided change the category routing and removing /categoria/ the category route yet works but App Route don't works anymore, return HTTP ERROR 500.

//DON'T WORKS

    $router = new Router();

    //App Route
    $router->add(
        '/online/{slug}',
        array(
            'controller'    =>  'application',
            'action'        =>  'app',
            'slug'          =>  1,
        ));

    //Category Route
    $router->add(
      '/{slug_category}/{current_page}',
      array(
          'controller'        =>  'category',
          'action'            =>  'apps',
          'slug_category'     =>  1,
          'current_page'      =>  2,
    ));

    return $router;
});
https://mysite.com/online/app_name  //HTTP ERROR 500
https://mysite.com/name_category //OK

So, what is wrong on this second script that causes this erro on app route?

edited May '16

Try to organize your routes with RouterGroup component. https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Router_Group.html