Cloning Frontend Environment

Hello, I have installed and configured yii2 advanced template, but I need one more environment/sub-application to put all the API controllers and functions.

My vhost config look like this:




www.app.com       ->  app/frontend/web

www.app.com/admin ->  app/backend/web

www.app.com/api   ->  app/api/web



and .htaccess in each /web folder with an extra rule for the frontend/web:




RewriteEngine on

#RewriteRule ^(api|admin)($|/) - [L]  #enabled only on frontend/web

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php



For the api directory I cloned the forntend removed most of the default files and replaced all calls to "frontend/" with "api/".

But there is still something missing … i get ‘yii\base\InvalidRouteException’ .

Is there a better way to do this ? or may be some one can give me a pointer what can be the problem.