[rtl]
[font="Tahoma"]حذف کردن دایرکتوری web از آدرس ها
[/font][/rtl]
site : localhost/advanced
admin: localhost/advanced/panel
[b].htaccess [root]
[/b]
# prevent directory listings
Options -Indexes
IndexIgnore */*
# follow symbolic links
Options FollowSymlinks
RewriteEngine on
RewriteRule ^panel(/.+)?$ backend/web/$1 [L,PT]
RewriteRule ^(.+)?$ frontend/web/$1
[b].htaccess [frontend/web]
[/b]
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
[b].htaccess [backend/web]
[/b]
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
[b]frontend/config/main.php
[/b]
use \yii\web\Request;
$baseUrl = str_replace('/frontend/web', '', (new Request)->getBaseUrl());
'components' => [
'request' => [
'baseUrl' => $baseUrl,
],
'urlManager' => [
'baseUrl' => $baseUrl,
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => []
]
[b]backend/config/main.php
[/b]
$baseUrl = '/advanced/panel';
'components' => [
'request' => [
'baseUrl' => $baseUrl,
],
'urlManager' => [
'baseUrl' => $baseUrl,
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => []
]