Shared hosting with wordpress - htaccess

Hi.
I’m trying to deploy a basic webapp on a shared environment where Wordpress is on the root. The Yii2 app is in /subfolder.

I’m following this guide. In WP’s .htaccess I added:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /subfolder
    RewriteCond %{REQUEST_URI} ^/subfolder
    RewriteCond %{REQUEST_URI} !^/subfolder/web
    RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
    RewriteRule ^css/(.*)$ /web/css/$1 [L]
    RewriteRule ^js/(.*)$ /web/js/$1 [L]
    RewriteRule ^images/(.*)$ /web/images/$1 [L]
    RewriteRule (.*) /web/$1 [L]

    RewriteBase /subfolder
    RewriteCond %{REQUEST_URI} ^/subfolder
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /web/index.php
</IfModule>

But with these rule added all wordpress’ pages are handled (or attempted) through Yii, so this breaks the blog installation. It’s the first block of rules capturing all the pages, but I don’t understand why as the two RewriteCond should intercept only the Yii app URIs. I checked mod_rewrite docs but couldn’t understand what’s wrong. Any help is appreciated. Thanks