url creation fails/no links from frontend ->backend posiible

Hi guys, I try to create a link from frontend to backend, but I’m not succeeded, for hours…

I’ll gonna kiss everybody,how will be able to solve this huge problem. All suggestions from other forums failed,too!

Here is my frontend/main.php




     'urlManager' => [

            'class' => 'yii\web\UrlManager',

            'baseUrl' => '',

            'enablePrettyUrl' => false,

            'showScriptName' => false,

        ],

        'urlManagerBackend' => [

            'class' => 'yii\web\UrlManager',

            'baseUrl' => '/backend/web/',

            'enablePrettyUrl' => false,

            'showScriptName' => false,

        ],



Here is my backend/main.php




    'urlManager' => [

            'class' => 'yii\web\UrlManager',

            'baseUrl' => '/backend',

            'enablePrettyUrl' => false,

            'showScriptName' => false,

        ],

        'urlManagerFrontend' => [

            'class' => 'yii\web\UrlManager',

            'baseUrl' => '',

            'enablePrettyUrl' => false,

            'showScriptName' => false,

        ],



and here is the link,wich won’t switch to backend




$backendUrl = \Yii::$app->urlManagerBackend->createUrl(['site/index']);






echo"<font color='white'>.$backendUrl. </font>";



will outprint following url:




/Yii2_perswitch/frontend/web/yiic.php?r=site%2Flogin



Furthermore, following link will throw out 404 error:




<?= Html::a('zum Backend', [$backendUrl]) ?><br>



P.S.:There is no possibility to change server configuration

You need set backend and frontend domain names, for example, to Yii::$app->params and create urls througn urlManager::createAbsoluteUrl

setHostInfo()