Answer the question
In order to leave comments, you need to log in
How to create and apply a separate config for a module in Yii?
Good afternoon, is it possible to create a separate config and entry point in the admin module or somehow separate it at the application level. I need to change the rules for the UrlManager while being in the module.
Answer the question
In order to leave comments, you need to log in
In .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ admin.php [L]
# если директория или файл существуют, использовать их напрямую
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# иначе отправлять запрос на файл index.php
RewriteRule . index.php
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/admin.php';
//defined('YII_DEBUG') or define('YII_DEBUG',true);
//defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question