title: Yii2 advanced accessing frontend from backend using alias
body: <p>I trying to access frontend/web from backend menu using alias</p>
  
  <p><code>yii:yii2 advanced</code>
  <code>webserver : XAMPP</code>
  <code>IDE:net beans</code></p>
  
  <p>codes I modified:</p>
  
  <p>C:\xampp\htdocs\advanced\common\config\aliases.php</p>
  
  <pre><code>Yii::setAlias('fronthome', dirname(dirname(__DIR__)) . '/frontend/web/');
  </code></pre>
  
  <p>C:\xampp\htdocs\advanced\backend\views\layouts\main.php</p>
  
  <pre><code>if (Yii::$app-&gt;user-&gt;isGuest) {
      $menuItems[] = ['label' =&gt; 'Login', 'url' =&gt; ['/site/login']];
      $menuItems[] = ['label' =&gt; 'fronthome', 'url' =&gt; Yii::getAlias('@fronthome')];
  </code></pre>
  
  <p>but when accessing "fronthome" menu via backend menu; browser was returning the url:
      <code>http://localhost/advanced/backend/web/C:/xampp/htdocs/advanced/frontend/web</code></p>
  
  <p>what i wanted browser to give: 
      <code>http://localhost/advanced/frontend/web/</code></p>
  
  <p>can some one please put some light... I searched but there was no elegant solution which I could find via alias.</p>
  
  <p>Thanks</p>
  
  <p>I got it working by making the below change</p>
  
  <p>C:\xampp\htdocs\advanced\common\config\aliases.php</p>
  
  <p><code>Yii::setAlias('fronthome', dirname(dirname(__DIR__)) . '/frontend/web/');</code></p>
  
  <p>to</p>
  
  <p><code>Yii::setAlias('fronthome', '../../frontend/web/');</code></p>