Answer the question
In order to leave comments, you need to log in
How to set up on yii2 advanced hosting?
Hi all !!! I'm switching to yii2. How to set up so that when going to the site.local site, the frontend folder opens and does not show all folders, where to set it up? and also current from the backend - site.local/admin - the backend folder was opened.
Answer the question
In order to leave comments, you need to log in
from myself and for myself
# Mod_Autoindex
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Mod_Rewrite
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
IndexIgnore */*
RewriteRule ^admin/(.*)?$ /backend/web/$1 [L,PT]
RewriteRule ^admin(.*)?$ /backend/web/$1 [L,PT]
RewriteRule ^([^/].*)?$ /frontend/web/$1
</IfModule>
<?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')
);
use \yii\web\Request;
$baseUrl = str_replace('/backend/web', '', (new Request)->getBaseUrl());
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'backend\controllers',
'components' => [
'request' => [
'baseUrl' => $baseUrl . "/admin",
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix'=>'/',
'rules'=>array(
''=>'site/index',
'<action>'=>'site/<action>',
),
],
],
'params' => $params,
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question