# ============================================
# OPTIMIZACIONES PARA REDUCIR ERRORES 503
# ============================================

# Timeouts optimizados - liberan conexiones rápido
<IfModule mod_headers.c>
    Timeout 45
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 3
</IfModule>

# Compresión GZIP
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml
</IfModule>

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

# ============================================
# REGLAS DE REWRITE (OPTIMIZADAS)
# ============================================
<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Handle Authorization Header (para APIs)
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    # Redirige todo lo que no sea una carpeta o archivo existente a informados/public
    RewriteCond %{REQUEST_URI} !^/informados/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /informados/public/$1 [L,QSA]
</IfModule>

# ============================================
# CONFIGURACIÓN PHP OPTIMIZADA
# ============================================
<IfModule lsapi_module>
    php_flag display_errors Off
    php_value max_execution_time 120
    php_value max_input_time 120
    php_value max_input_vars 3000
    php_value memory_limit 256M
    php_value post_max_size 32M
    php_value upload_max_filesize 16M
    php_value session.gc_maxlifetime 1440
    php_flag zlib.output_compression On
</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php84” package as the default “PHP” programming language.
<IfModule mime_module>
    AddHandler application/x-httpd-alt-php84 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit