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

Categories as the first level subdirectory


I have some routes in my app including:



Now I also want my categories (e.g. programming, physics, biology, ...) use the first level subdirectories (our SEO person has requested this). I mean we can have

https://www.site.com/programming (to show list of programming discussions)

https://www.site.com/physics (to show list of physics discussions)

The problem is that if I define a route as following, even the login and users actions are forwarded to this route


The order of route definition (i.e. the priority) is not considered. If it was considered, I could first define /login and /users and then /{category} at the end.

What can I do to solve this problem?


Reverse the order in which you define your rules. By default, the router evaluates rules from bottom to top, in order of definition.


Thank you very much. That solved the problem.