Options -Indexes

#<IfModule mod_rewrite.c> 
#  RewriteEngine on
#  RewriteCond %{REQUEST_URI} !^public
#  RewriteRule ^(.*)$ frontend/web/$1 [L] 
#</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
    RewriteCond %{REQUEST_URI} admin
    RewriteRule .* backend/web/index.php [L]

    RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|img)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !admin
    RewriteRule .* frontend/web/index.php [L]
</IfModule>

# Deny accessing below extensions
<Files ~ "(\.json|\.lock|\.git)">
    Order allow,deny
    Deny from all
</Files>

# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]