# Allow access to public files
Options -Indexes

# Allow all files in public directory
<FilesMatch ".*">
    Order Allow,Deny
    Allow from all
</FilesMatch>

# Ensure static files are served directly
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Redirect all requests to index.php unless they are for existing files or directories
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ ../index.php [QSA,L]
</IfModule>