title: From Backend to Frontend Yii2 Advanced App
body: <p>I'm trying to link some controllers from frontend to backend. After some hours I don't where could be the problem.</p>
  
  <p><strong>Backend</strong></p>
  
  <pre><code>file: main.php
  
      'urlManager' =&gt; [
          'enablePrettyUrl' =&gt; false,
          'showScriptName' =&gt; false,
          'baseUrl' =&gt; '/backend/web',
      ],        
      'urlManagerFrontEnd' =&gt; [
          'class' =&gt; 'yii\web\urlManager',
          'baseUrl' =&gt; '/frontend/web',
          'enablePrettyUrl' =&gt; false,
          'showScriptName' =&gt; false,
      ]
  
  
  file: SiteController.php
  
      public function actionIndex()
      {
          // User's variable
          $user = \common\models\User::findIdentity(Yii::$app-&gt;user-&gt;id);
  
          if($user-&gt;role != self::USER_ADMIN){
              return $this-&gt;redirect(Url::to(Yii::$app-&gt;urlManagerFrontEnd-&gt;createUrl(['/site/index'])));
          }
  
          return $this-&gt;render('index');
      }
  </code></pre>
  
  <p>Using this </p>
  
  <blockquote>
    <p>Url::to(Yii::$app->urlManagerFrontEnd->createUrl(['/site/index']))</p>
  </blockquote>
  
  <p>Returns me</p>
  
  <blockquote>
    <p>/advanced/backend/web/index.php?r=site%2Findex</p>
  </blockquote>
  
  <p>Any advice?</p>