# ==============================================================================
# FÉRTIL · Configuración de Servidor Web Apache / LiteSpeed (Hostinger)
# ==============================================================================

# 1. Habilitar RewriteEngine
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Redirigir a HTTPS seguro
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# 2. Codificación de caracteres UTF-8
AddDefaultCharset UTF-8
AddCharset UTF-8 .html .css .js .xml .json .vcf

# 3. Tipos MIME para fuentes, vectores e imágenes modernas
<IfModule mod_mime.c>
  AddType image/svg+xml .svg .svgz
  AddType image/webp .webp
  AddType text/vcard .vcf
  AddType application/json .json
  AddType font/woff2 .woff2
  AddType font/woff .woff
</IfModule>

# 4. Compresión Gzip para máxima velocidad de carga
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json image/svg+xml
</IfModule>

# 5. Caché de navegador para recursos estáticos
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 month"
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType text/javascript "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>

# 6. Seguridad HTTP básica
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
