Yii2 403 Forbidden after Twig installation

Hi guys,

I was working with Yii framework for one month. Recently I changed templating from default to Twig, through composer. Now I’m randomly receiving errors:

I would appreciate any help with getting know what is causing the error. I’m using .htaccess in {project} dir:


<IfModule mod_rewrite.c>

    RewriteEngine On


    RewriteRule ^(.*)$ {app}/$1 [L]

</IfModule>



And .htaccess in {project}/{app} dir:


<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>

        Options -MultiViews

    </IfModule>


    RewriteEngine On


    # Redirect Trailing Slashes...

    RewriteRule ^(.*)/$ /$1 [L,R=301]


    # Handle Front Controller...

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^ index.php [L]

</IfModule>

PS. {project}/{app} is just dir structure on my disk eg. my_project/my_app

PS. 2 I tried with Twig caching set to On/Off

PS. 3 I have permission on .htaccess files set to 644

PS. 4 Sometimes Twig shows empty page, or is not loading external CSS assets…

Looks like a problem of the permissions of the twig view files … some have enough permissions while others not.