RewriteEngine On

# If the requested resource is a real file or directory, serve it normally
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Allow direct access to common static asset types (safety).
RewriteRule \.(css|js|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$ - [L,NC]

# Prevent redirecting the index (avoid loops)
RewriteRule ^index\.php$ - [L,NC]

# Otherwise redirect tenant panel routes to main admin panel (relative path works under any base)
RewriteRule ^.*$ ../index.php [R=302,L]