<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Redirect everything to public/
    RewriteRule ^$ public/ [L]
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Deny access to sensitive directories
<IfModule mod_authz_core.c>
    <FilesMatch "\.(php|sql|env|log|md)$">
        Require all denied
    </FilesMatch>
</IfModule>

# Allow public/index.php
<Files "public/index.php">
    <IfModule mod_authz_core.c>
        Require all granted
    </IfModule>
</Files>
