Yii2 - subdomain routing

Viewed 2922

I want to use subdomain as id, and I need dynamic router to do this. In urlManager, I added this line:

"http://<user:\w+>.local.dev/<controller:\w+>/<action>" => '<controller>/<action>',

When I try any action, for example:

function actionMyAccount($user){
echo $user;...
}

I am not getting anything - the var isn't printed, and script stops working (screen is white). When I remove $user, the page is loading without any problems

How can I achieve subdomain router?

1 Answers
Related