Options -Indexes
DirectoryIndex index.php

# PHP settings
<IfModule mod_php.c>
    php_value upload_max_filesize 10M
    php_value post_max_size 10M
    php_value max_execution_time 120
    php_value memory_limit 256M
</IfModule>

# Security headers
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Block direct access to sensitive directories
<FilesMatch "\.(sql|log|md|env|json|lock|sh|bak)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Protect config and database directories
RewriteEngine On
RewriteRule ^(config|database|vendor)/.*$ - [F,L]

# Allow normal access to assets, modules, api, index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [QSA,L]
