Options -Indexes
<FilesMatch "\.(sql|log|ini|env|bak|config\.php)$">
  Require all denied
</FilesMatch>

# Pictures live in a persistent folder outside the system folder (see upload_storage.php).
# If a picture is not physically inside public/uploads, serve it from there.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^uploads/([A-Za-z0-9._-]+)$ file.php?f=$1 [L,QSA]
</IfModule>
