*In web config:
- urlManager:
‘urlManager’ => [
‘class’ => ‘yii\web\UrlManager’,
‘baseUrl’=>’’,
‘enablePrettyUrl’ => true,
‘showScriptName’ => false,
‘suffix’ => ‘’,
‘enableStrictParsing’ => false,
‘rules’ => []
]
- ‘request’:
‘request’=>[
‘baseUrl’=>’’
]
*In .htaccess (/web/.htaccess):
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteCond %{REQUEST_URI} !^/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /$1
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(/)?$ index.php
==>>>>>>>>>>>>>>>>>>>
From above configuration, i had more friendly urls with hidding index.php and moving root directory to /web directory.
My url become mydomain.com/ ,but a problem happens with NavBar::begin and Nav::widget.
-
In NavBar::begin : ‘brandUrl’ => Yii::$app->homeUrl return properly as ‘mydomain.com/’, (not mydomain.com/web).
-
In Nav::widget : urls in items array return properly such as ‘mydomain.com/site/about’, but as I click to about page, there is a error : “Not Found . The requested URL /web/site/about was not found on this server.”.
So, I think the problem is url in item of items array inside Nav::widget, it does not return properly.It show ‘mydomain.com/site/about’ but the error is /web/site/about not found.
May everybody help me, please.I’m sorry because my English is not well.
Thanks.