# Plataforma Ganadera - .htaccess publico

# --- Forzar version PHP (descomentar la correcta) ---
# AddHandler application/x-httpd-ea-php81 .php
# AddHandler application/x-httpd-ea-php82 .php
# AddHandler application/x-httpd-ea-php84 .php
# AddHandler application/x-httpd-ea-php85 .php

# --- REWRITE ---
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # manifest.json dinamico
    RewriteRule ^manifest\.json$ manifest.php [L]

    # Redirigir /install a install.php
    RewriteRule ^install$ install.php [L,R=302]

    # Enrutar todo lo demas a index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

# --- SEGURIDAD ---
<IfModule mod_authz_core.c>
    <FilesMatch "^(\.env|\.htpasswd|\.git|installed\.php)$">
        Require all denied
    </FilesMatch>
</IfModule>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-XSS-Protection "1; mode=block"
</IfModule>

# --- COMPRESION ---
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
    AddOutputFilterByType DEFLATE text/css text/javascript application/javascript
    AddOutputFilterByType DEFLATE application/json application/xml
</IfModule>

# --- CACHE ---
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
</IfModule>

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