Answer the question
In order to leave comments, you need to log in
How to hide the name of the controller and action in Yii2?
How can I set up urlManager rules so that the name of the controller and action is not displayed in the address bar, but the ID of a specific post immediately goes, for example.
Let's say there is an address " example.com?r=site&a=action&id=2 ", but you need to do "example.com/2" .
Answer the question
In order to leave comments, you need to log in
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<id>' => 'site/action'
],
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question