RewriteEngine On

# Serve real files/directories (assets) directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Everything else goes through the front controller
RewriteRule ^ index.php [L]

# Never allow direct access to config, app, database, or storage from the web root
<IfModule mod_alias.c>
  RedirectMatch 404 ^/(config|app|database|storage|vendor)/
</IfModule>

# Basic hardening
Options -Indexes
ServerSignature Off

<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
</IfModule>
