Erorr Not Found After Configurating .htaccess File For /web Directory

*In web config:

  • urlManager:

‘urlManager’ => [

‘class’ => ‘yii\web\UrlManager’,


‘enablePrettyUrl’ => true,

‘showScriptName’ => false,

‘suffix’ => ‘’,

‘enableStrictParsing’ => false,

‘rules’ => []


  • ‘request’:




*In .htaccess (/web/.htaccess):

RewriteEngine on

RewriteCond %{HTTP_HOST} ^$

RewriteCond %{REQUEST_URI} !^/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /$1

RewriteCond %{HTTP_HOST} ^$

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 ,but a problem happens with NavBar::begin and Nav::widget.

  • In NavBar::begin : ‘brandUrl’ => Yii::$app->homeUrl return properly as ‘’, (not

  • In Nav::widget : urls in items array return properly such as ‘’, 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 ‘’ but the error is /web/site/about not found.

May everybody help me, please.I’m sorry because my English is not well.