<IfModule mod_rewrite.c>
    RewriteEngine On

    # Prevent infinite loops
    RewriteCond %{ENV:REDIRECT_STATUS} 200
    RewriteRule ^ - [L]

    # Route asset requests to the public directory
    RewriteCond %{REQUEST_URI} !^/backend-laravel/public/
    RewriteRule ^(build|storage|css|js|images|vendor|favicon\.ico)/(.*)$ public/$1/$2 [L]

    # Route everything else to the new root index.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>