<?php
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log','gii'],
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1']
],
],
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => 'advanced-backend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<module:gii>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
],
],
],
'params' => $params,
];
RewriteEngine on
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.browerrc
# если это папка или файл, открываем его
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# в противном случае перенаправляем на index.php
RewriteRule . index.php
<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
require __DIR__ . '/../../yii2/vendor/autoload.php';
require __DIR__ . '/../../yii2/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../yii2/common/config/bootstrap.php';
require __DIR__ . '/../../yii2/backend/config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../../yii2/common/config/main.php',
require __DIR__ . '/../../yii2/common/config/main-local.php',
require __DIR__ . '/../../yii2/backend/config/main.php',
require __DIR__ . '/../../yii2/backend/config/main-local.php'
);
(new yii\web\Application($config))->run();
<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
require __DIR__ . '/../yii2/vendor/autoload.php';
require __DIR__ . '/../yii2/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../yii2/common/config/bootstrap.php';
require __DIR__ . '/../yii2/frontend/config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../yii2/common/config/main.php',
require __DIR__ . '/../yii2/common/config/main-local.php',
require __DIR__ . '/../yii2/frontend/config/main.php',
require __DIR__ . '/../yii2/frontend/config/main-local.php'
);
(new yii\web\Application($config))->run();