Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Categories as the first level subdirectory

Hello

I have some routes in my app including:

/login

/users

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

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

http://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

/{category}

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?



77.3k
Accepted
answer

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



5.3k

Thank you very much. That solved the problem.