# --- Allow static assets (JS/CSS/fonts/images) ---
<FilesMatch "\.(?:css|js|png|jpe?g|gif|webp|avif|svg|ico|woff2?|ttf|eot|map)$">
  Require all granted
</FilesMatch>

# Si el archivo o dir existe, sírvelo tal cual (no reescribir ni bloquear)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
</IfModule>
# --- /Allow static assets ---

# =========================================
# BASE SEGURO (cabeceras, CORS, admin no-cache)
# =========================================

# --- Tipos MIME útiles
<IfModule mod_mime.c>
  AddType image/webp .webp
  AddType image/avif .avif
  AddType image/svg+xml .svg .svgz
  AddType font/woff2 .woff2
  AddType font/woff  .woff
</IfModule>

# --- No cache para combinadores del admin (evita CSS/JS viejos en /wp-admin)
<IfModule mod_headers.c>
  <FilesMatch "^(load-(styles|scripts)\.php)$">
    Header unset ETag
    Header unset Cache-Control
    Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header set Pragma "no-cache"
    Header set Expires "0"
  </FilesMatch>
</IfModule>

# --- CORS para fuentes y SVG (evita errores en iconos/carousels)
<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|otf|eot|woff2?|svg)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

# --- Evitar listado de directorios
Options -Indexes

# =========================================
# BLOQUE WORDPRESS (no tocar)
# =========================================
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

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