В конфигурационном файла backend/main.php или backent/main-local.php сделайте следующее:
<?php
use yii\web\Request;
$baseUrl = str_replace('/backend/web', '/admin', (new Request())->getBaseUrl());
$config = [
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'your_validation_key',
'baseUrl' => $baseUrl
],
],
];
}
return $config;
Уберите комментарий с секции urlManager
В backend/web положите htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
В корень проекта положите htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin(/.*)?$ backend/web/$1 [L]
# handle the case of frontend
RewriteCond %{REQUEST_URI} ^/
RewriteRule ^(.*)$ frontend/web/$1 [L]