# Sistema Médico - Configuración Apache

# Habilitar rewrite engine
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /sistema-medico/
</IfModule>

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

# Proteger archivos sensibles
<FilesMatch "(config\.php|database\.php|auth\.php)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Configuración de PHP
<IfModule mod_php7.c>
    php_value upload_max_filesize 10M
    php_value post_max_size 10M
    php_value max_execution_time 300
    php_value max_input_time 300
</IfModule>

# Páginas de error personalizadas
ErrorDocument 404 /sistema-medico/index.php
ErrorDocument 403 /sistema-medico/index.php

# Comprimir archivos
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>

# Cache de archivos estáticos
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
</IfModule>
