# ============================================================
#  API INSTITUTO PAITA — Reescritura de URLs y CORS
# ============================================================

# Habilitar motor de reescritura
RewriteEngine On

# Permitir cabecera Authorization (Apache a veces la elimina)
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [E=HTTP_AUTHORIZATION:%1]

# Si la petición NO es un archivo o carpeta real, enviar a api.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ api.php [QSA,L]

# Proteger archivos sensibles
<FilesMatch "\.(env|sql|md|json|lock)$">
    Require all denied
</FilesMatch>

# Permitir composer.json sólo en local si se desea (denegado por defecto arriba)

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