config /web.php
$params = require __DIR__ . '/params.php'; $db = require __DIR__ . '/db.php'; $config = [ 'id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'components' => [ 'assetManager' => [ // override bundles to use local project files : 'bundles' => [ 'yii\bootstrap4\BootstrapAsset' => [ 'sourcePath' => '@app/assets/source/bootstrap/dist', 'css' => [ YII_ENV_DEV ? 'css/bootstrap.css' : 'css/bootstrap.min.css', ], ], 'yii\bootstrap4\BootstrapPluginAsset' => [ 'sourcePath' => '@app/assets/source/bootstrap/dist', 'js' => [ YII_ENV_DEV ? 'js/bootstrap.js' : 'js/bootstrap.min.js', ] ], ], ], 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'V_Pj-uMLTPPxv0Be5Bwe3-UCC6EjGRuH', 'baseUrl' => '', ], 'formatter' => [ 'dateFormat' => 'dd/MM/yyyy', 'decimalSeparator' => ',', 'thousandSeparator' => '.', 'currencyCode' => 'BRL', 'locale' => 'pt-BR', 'defaultTimeZone' => 'America/Sao_Paulo', 'class' => 'yii\i18n\Formatter', ], 'datehelper' => [ 'class' => 'app\components\DateBRHelper', ], 'formatcurrency' => [ 'class' => 'app\components\FormatCurrency', ], 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => '123456', ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], 'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'db' => $db, 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'enableStrictParsing' => true, 'rules' => [ '' => 'site/index', '<controller:\w+>/<action:\w+>/' => '<controller>/<action>', ], ], ], 'params' => $params, ]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; } return $config;
arquivo.htaccess na pasta raiz
<IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On </IfModule> <IfModule mod_rewrite.c> RewriteCond %{REQUEST_URI} ^/.* RewriteRule ^(.*)$ web/$1 [L] RewriteCond %{REQUEST_URI} !^/web/ RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ web/index.php </IfModule>
.htaccess dentro da pasta web/
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php