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

Phalcon Router same url

Is it posible to have same router with different controller and action?


    $router->add('/:params', array(
        'module' => 'frontend',
        'controller' => 'center',
        'action' => 'page',
        'params' => 1,

    $router->add('/:params', array(
        'module' => 'frontend',
        'controller' => 'page',
        'action' => 'view',
        'params' => 1,

It will use the first one it encounters when matching routes, so one of them will be discarded.

I can't imagine what practical use there would be for having 2 routes with the same pattern.

This is the case my client want same url for the page and center

example: https://mysite/center-slugs - this is for center https://mysite/page-slugs - this is for page..

edited Aug '15

basicaly we did a dirty hack to make this happend thank you for the reply...

public function pageAction($slugs){

    if(page != null){
        execute page
         //execute center
         //redirect view to center view
         $this->view->pagelayout = 'center';


fucntion centerAction($slugs){
    //code for center call