I make an application on yii2-advanced, I configure access to the backend for the admin. after I set up the rights, the link to the admin panel gets lost and an error pops up, and the old directory appears in the address bar, from which I deleted the index.php file and the site directory. tell me where to look for the way?

31.08.2018 imgsrv/admin/site/login - (такого пути нет) http://imgsrv/admin/site/login 1/1 An Error occurred while handling another error: yii\base\InvalidRouteException: Unable to resolve the request "/error". in /var/www/imgsrv/vendor/yiisoft/yii2/base/Module.php:537 Stack trace: #0 /var/www/imgsrv/vendor/yiisoft/yii2/web/ErrorHandler.php(108): yii\base\Module->runAction('/error') #1 /var/www/imgsrv/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpExcep #2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException)) #3 {main} Previous exception: yii\base\InvalidRouteException: Unable to resolve the request: site/login in /var/www/imgsrv/vendor/yiisoft/yii2/base/Controller.php:128 Stack trace: #0 /var/www/imgsrv/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('login', Array) #1 /var/www/imgsrv/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('site/login', Array) #2 /var/www/imgsrv/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request)) #3 /var/www/imgsrv/backend/web/index.php(17): yii\base\Application->run() #4 {main} Next yii\web\NotFoundHttpException: Страница не найдена. in /var/www/imgsrv/vendor/yiisoft/yii2/web/Application.php:115 Stack trace: #0 /var/www/imgsrv/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request)) #1 /var/www/imgsrv/backend/web/index.php(17): yii\base\Application->run() #2 {main} 

The error appears after adding the following lines:

  'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => ['index', 'create', 'view', 'update', 'delete'], 'allow' => true, 'roles' => ['admin'], ], ], ], 

upd: the AccessControl subroutine produces an error. but why?

  • Perhaps some data is cached, so the errors are - ArchDemon pm
  • No, the problem was different. - dasauser

1 answer 1

The problem turned out to be in the unconfigured config/main.php for the frontend and backend , which were different in different files and should have been the same :

  'user' => [ 'identityClass' => 'common\models\Users', 'identityCookie' => ['name' => '_identity-site', 'httpOnly' => true], ], 'session' => [ 'name' => 'advanced-site', ], 

Write these lines in both files.