RewriteEngine off
# For Backend
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/yii2-app/admin
RewriteRule ^admin(/.+)?$ backend/web/$1 [L,PT]

# If a directory or a file exists, use it directly

#RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . frontend/web/$1
RewriteRule index.php frontend/web/index.php

