Web frontend - localhost (directory apache2/htdocs in the LAMP), web backend - localhost:8080/backend (apache2/htdocs/backend). Yii advanced application in the same directory with htdocs - mafia-yii (apache2/mafia-yii). File main.php in backend/config:
'components' => [
....
'urlManager' => [
// here is your normal backend url manager config
'class' => 'yii\web\UrlManager',
'baseUrl' => 'http://localhost/backend',
],
'urlManagerFrontend' => [
'class' => 'yii\web\UrlManager',
'hostInfo' => 'http://localhost',
'baseUrl' => 'http://localhost',
],
],
file ~/lampstack-7.0.4-0/apache2/mafia-yii/backend/views/layouts/main.php :
....
$menuItems[] = ['label' => 'Backend', 'url' => ['/site/index']];
$menuItems[] = ['label' => 'Fronend', 'url' => [Yii::$app->urlManagerFrontend->createUrl('/site/index')]];
....
Result: http://localhost:8080/backend/index.php?r=backend%2Findex.php%3Fr%3Dsite%252Findex
Not Found (#404)