Configuring yii2.0 folder structure

Hello,

I am trying to separate the framework code from my code.

Below example illustrates my requirments

I would like to place the framework under


/var/www/yii2.0

I would like to place all my(application) code which uses the framework under


/var/www/myapp/web

I did the following

  1. Changed the basePath in web.php to

basePath=/var/www/myapp/web

  1. Changed the index.php to

require('/var/www/yii2.0/vendor/autoload.php');

require('/var/www/yii2.0/vendor/yiisoft/yii2/Yii.php');


$config = require('/var/www/yii2.0/config/web.php');

But it still gives the below error


exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in /var/www/yii2.0/vendor/yiisoft/yii2/base/Module.php:461

Stack trace:

#0 /var/www/yii2.0/vendor/yiisoft/yii2/web/ErrorHandler.php(79): yii\base\Module->runAction('site/error')

#1 /var/www/yii2.0/vendor/yiisoft/yii2/base/ErrorHandler.php(95): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))

#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))

#3 {main}

Previous exception:

exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "".' in /var/www/yii2.0/vendor/yiisoft/yii2/base/Module.php:461

Stack trace:

#0 /var/www/yii2.0/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('', Array)

#1 /var/www/yii2.0/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))