# Sistema de Administración de Veterinaria
# Configuración de Apache

# Habilitar RewriteEngine
RewriteEngine On

# Redirigir a HTTPS (descomentar si se usa SSL)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Proteger archivos de configuración
<FilesMatch "^\.">
    Order allow,deny
    Deny from all
</FilesMatch>

# Proteger archivos PHP de configuración
<FilesMatch "(config|database)\.php$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Configuración de PHP
php_flag display_errors Off
php_value upload_max_filesize 5M
php_value post_max_size 10M
php_value max_execution_time 300
php_value memory_limit 128M

# Prevenir listado de directorios
Options -Indexes

# Configuración de tipos MIME
AddType application/pdf .pdf
AddType image/jpeg .jpg .jpeg
AddType image/png .png
AddType image/gif .gif

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

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