# SOL — Routing básico para dev/prod con PHP
# - Sirve cualquier archivo o carpeta existente (assets, node_modules, api/*.php, etc.)
# - No reescribe /api/*.php (endpoints directos para DataTables Editor)
# - En DEV habilita el acceso a /node_modules (si existe) para cargar vendor JS/CSS sin CDN

Options -Indexes
Options -MultiViews
RewriteEngine On

# 1) Si el recurso existe como archivo o directorio → servir y cortar
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# 2) Whitelist /api/*.php (endpoints directos)
#    Ej.: /api/parametros/productos → /api/parametros/productos.php
RewriteRule ^api/(.+)$ api/$1 [L]

# 3) Whitelist /node_modules/* (solo DEV). Si no existe, esta regla no hace nada.
RewriteRule ^node_modules/(.*)$ node_modules/$1 [L]

# 4) (Opcional) Si usás front-controller, acá reescribís a tu index.php
#    Descomenta y adapta si tienes router global
# RewriteRule ^ index.php [L]
