Answer the question
In order to leave comments, you need to log in
Can several different actions coexist on the same url format?
Greetings web developers. Here's the thing. I am using the YII2 framework. There are 2 different actions that render different page types and work
with different models. But I want the url to have the same format. Therefore, in web.php, in the routing section, I prescribe the following rules:
'<alias:[\w-]+>' => 'controller/action1',
'<alias:[\w-]+>' => 'controller/action2',
Answer the question
In order to leave comments, you need to log in
You can implement your own class of rules , at least the first one, if the logic does not fit this rule, then return false, where the second route will catch
Create a table with aliams and their relationship to the desired actions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question