RewriteEngine On
RewriteBase /almacencrm/

# Charset
AddDefaultCharset utf-8

# Manifest MIME
AddType application/manifest+json .webmanifest

# ========= NO CACHE para dinmicos =========
<IfModule mod_headers.c>
  # Todas las respuestas PHP/JSON sin cach
  <FilesMatch "\.(php|php5|php7|json)$">
    Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header set Pragma "no-cache"
    Header set Expires "0"
  </FilesMatch>

  # Directorios sensibles: ajax y controllers SIEMPRE sin cach
  <LocationMatch "^/almacencrm/(ajax|controllers)/">
    Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header set Pragma "no-cache"
    Header set Expires "0"
  </LocationMatch>
</IfModule>

# ========= Cach para estticos =========
<IfModule mod_expires.c>
  ExpiresActive On
  # JS/CSS 7 das (o sube a 1 ao si versionas con ?v=)
  ExpiresByType text/css "access plus 7 days"
  ExpiresByType application/javascript "access plus 7 days"
  ExpiresByType application/json "access plus 1 day"
  ExpiresByType application/manifest+json "access plus 7 days"
  ExpiresByType font/woff2 "access plus 30 days"
  ExpiresByType image/png "access plus 30 days"
  ExpiresByType image/jpeg "access plus 30 days"
  ExpiresByType image/webp "access plus 30 days"
  ExpiresByType image/svg+xml "access plus 30 days"
</IfModule>

