<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Allow direct access to existing files and directories
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Rewrite all other requests to index.php, preserving query string
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

# Set correct MIME types for static assets
AddType application/javascript .js
AddType application/json .json
AddType text/css .css
AddType image/svg+xml .svg
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
AddEncoding gzip .gz

# Disable mod_security for static files
<FilesMatch "\.(js|css|json|jpg|jpeg|png|gif|svg|woff|woff2|ttf|eot|ico)$">
    <IfModule mod_security.c>
        SecRuleEngine Off
    </IfModule>
</FilesMatch>

