I wanted to separate the manager and the interface:
root / manager / controllers / SiteController.php
namespace manager\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;
class SiteController extends Controller
{
public function actionIndex()
{
echo 'hallo';
}
}
root / manager / configuration / web.php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'manager\controllers',
'bootstrap' => ['log'],
'modules' => [
'manager' => [
'class' => 'manager\Module',
],
],
'components' => [
'request' => [
'cookieValidationKey' => 'X',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => require(__DIR__ . '/db.php'),
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'' => 'site/index',
'fragebogen/erstellung/<id>' => 'questionary/creation',
'fragebogen/erstellung' => 'questionary/creation',
'auftraege-importieren' => 'upload/jobs',
'auftraege-erfolgreich-importiert' => 'upload/jobssuccess',
],
],
],
'params' => $params,
];
if (YII_ENV_DEV) {
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';
}
return $config;
root / manager / web / index.php
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
And I get this error:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in /kunden/xxx/xxx/vendor/yiisoft/yii2/base/Module.php:461 Stack trace:
Next exception 'yii\web\NotFoundHttpException' with message 'Unable to resolve the request "site/index".' in /kunden/xxx/xxx/vendor/yiisoft/yii2/web/Application.php:95 Stack trace:
