# Configuración de Apache para Bridgi

# Proteger archivos sensibles
<FilesMatch "(config\.php|db\.php|\.sql)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Prevenir listado de directorios
Options -Indexes

# Habilitar mod_rewrite
RewriteEngine On

# Redirigir a instalador si config.php no existe
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/install\.php
RewriteCond %{DOCUMENT_ROOT}/config.php !-f
RewriteRule ^(.*)$ /install.php [L,R=302]

# Protección contra inyección SQL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* - [F,L]

# Seguridad adicional
<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>
