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

Route Collision

Hi,

I have these two routes, they both are inside a group route class,

      $this->add('/login', array(
            'controller'    => 'user',
            'action'        => 'login'
        ))->setName("login");

and second one after the first one,

        $this->addGet('/{address}', array(
            'controller'    => 'user',
            'action'        => 'profile',
            'address'       => 1
        ))->setName("profile");

Normally, if a user tries to open: https://www.example.com/login, he/she should see a login page, but it redirects to profile route. Where is the problem?



8.1k

(As mentioned in the docs) routes are evaluated in reverse order.

It seems your 2nd route matches /login