Как-то так, думаю, а вообще вот тут все прекрасно описано
www.yiiframework.com/doc-2.0/guide-runtime-routing...namespace app\components;
use yii\web\UrlRuleInterface;
use yii\base\Object;
class MyUrlRule extends Object implements UrlRuleInterface
{
public $allowedActions = ['action1', 'action2'];
public function parseRequest($manager, $request)
{
if (null !== ($action = Yii::$app->getRequest()->post('action') && in_array($action, $this->allowedActions)
{
return ['controller/'.$action]
}
return false; // this rule does not apply
}
}
[
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'suffix' => '.html',
'rules' => [
// ...
[
'class' => 'app\components\MyUrlRule',
// ...configure other properties...
],
],
],
],
]