title: Application file re-organization in Yii 2
body: <p>I have set up new Yii2 project. Now I want to <a href="http://prntscr.com/8rqoyb" rel="nofollow noreferrer">reorganize folder structure</a> in two folders "public" and "app" (which actually represents the protected files).</p>
  
  <p>All the code from framework goes in "app" folder. In "public" folder I have only one script named "index.php" from where I'm calling the app. The code there looks like the following (I have only modified only the paths from the original "index.php").</p>
  
  <p><strong>app/index.php</strong></p>
  
  <pre><code>&lt;?php
  
  // comment out the following two lines when deployed to production
  defined('YII_DEBUG') or define('YII_DEBUG', true);
  defined('YII_ENV') or define('YII_ENV', 'dev');
  
  require(__DIR__ . '/../app/vendor/autoload.php');
  require(__DIR__ . '/../app/vendor/yiisoft/yii2/Yii.php');
  
  $config = require(__DIR__ . '/../app/config/web.php');
  
  (new yii\web\Application($config))-&gt;run();
  
  ?&gt;
  </code></pre>
  
  <p>This same approach was working in the Yii framework where we got different syntax of the commands. But now in Yii 2 I got the following issue:</p>
  
  <p><a href="https://i.stack.imgur.com/0TQcr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0TQcr.png" alt="enter image description here"></a></p>
  
  <p>So it seems like all the paths are pointing to the right files (I have check that), but I still got the error. So what I'm missing here? Why the basePath still recognize the "public" folder?</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>After following the comment from @marche and add the following code to the config file:</p>
  
  <pre><code>'components' =&gt; [
      ...
      'assetManager' =&gt; [
          'basePath' =&gt; 'my/path/to/assets',
      ],
      ...
  ],
  </code></pre>
  
  <p>I'm not getting the error with the screen anymore, <strong>but now the content is loaded without any CSS styling and without JS files (they are still pulling URL from the wrong places).</strong></p>