# Protección de archivos sensibles
<FilesMatch "^(config\.php|database\.sql)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Prevenir listado de directorios
Options -Indexes

# Proteger directorio uploads (solo imágenes)
<FilesMatch "\.(jpg|jpeg|png|gif)$">
    Order allow,deny
    Allow from all
</FilesMatch>

# Habilitar rewrite engine
RewriteEngine On

# Forzar HTTPS (descomentar en producción)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Prevenir acceso a archivos ocultos
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

# Configuración de seguridad
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
</IfModule>

# Configuración de PHP
php_flag display_errors Off
php_flag log_errors On
php_value max_execution_time 300
php_value upload_max_filesize 10M
php_value post_max_size 10M

