RewriteEngine On

# ---------------------------------
# 1. Forzar HTTPS
# ---------------------------------
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ---------------------------------
# 2. Permitir assets y api
# ---------------------------------
RewriteCond %{REQUEST_URI} ^/kpis\.dalegip\.com/public/assets/ [OR]
RewriteCond %{REQUEST_URI} ^/kpis\.dalegip\.com/public/api/
RewriteRule ^ - [L]

# ---------------------------------
# 3. Permitir archivos públicos explícitos
# ---------------------------------
RewriteCond %{REQUEST_URI} ^/kpis\.dalegip\.com/public/(index|login|logout)\.php$
RewriteRule ^ - [L]

# ---------------------------------
# 4. Redirigir cualquier otro acceso a index.php
# ---------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

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