Remove web part from URL related issue

Hello Friends,

I got success to remove web part from URL with help of "

Aaron Francis" tutorial.

using this tutorial i customize for my basic application of yii2, it work near fine but some file not include or occur "404: file not found" error in console.

so, my .htaccess is

<IfModule mod_rewrite.c>

    Options +FollowSymlinks

    RewriteEngine On


<IfModule mod_rewrite.c>

    RewriteCond %{REQUEST_URI} ^/(assets|css|images|js|fonts)

    RewriteRule ^/assets/$ /web/assets/$1 [L]

    RewriteRule ^css/(.*)$ web/css/$1 [L]

    RewriteRule ^images/(.*)$ web/images/$1 [L]

    RewriteRule ^js/(.*)$ web/js/$1 [L]

    RewriteRule ^fonts/(.*)$ web/fonts/$1 [L]

    RewriteRule ^assets/(.*)$ assets/$ [L]

    RewriteCond %{REQUEST_URI} !^/web/(assets|css|images|js|fonts)/

    RewriteCond %{REQUEST_URI} !index.php

    RewriteCond %{REQUEST_URI} ^/

    RewriteCond %{REQUEST_FILENAME} !-f [OR]

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^.*$ web/index.php


my web.php file:

'components' => [

        'request' => [

	    'class' => 'app\components\Request',

    	    'web'=> '/web',

            'cookieValidationKey' => 'secure',



my component file:


namespace app\components;

class Request extends \yii\web\Request {

    public $web;

    public $adminUrl;

    public function getBaseUrl(){

        return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl;



        If you don't have this function, the admin site will 404 if you leave off

        the trailing slash.


        Would work:  to

        Using this function, both will work.


    public function resolvePathInfo(){

        if($this->getUrl() === $this->adminUrl){

            return "";


            return parent::resolvePathInfo();





and at last i attached the error log file.


Yii Debugger.png

Plaese help me…

Thanks in Advance… :) :) :)

Delete your public_html then paste all the files and folders in basic folder in host root then rename web to public_html

No htaccess

I’ve your problem, or similar.

I cannot move my files.

Have you solved?

Get rid of all that htaccess noise.

Assuming apache, setup a VirtualHost, set the DocumentRoot to /web. Everything will work fine.