$host = $_SERVER['HTTP_HOST']; $path = trim($_SERVER['REQUEST_URI'], '/'); $subdominio = explode('.', $host)[0]; $base = "/srv/www/htdocs"; // 🔥 SI el archivo existe físicamente, NO uses router $fullPath = $base . "/" . $subdominio . "/" . $path; if ($path != '' && file_exists($fullPath)) { return false; // deja que Apache sirva el archivo directo } if ($path == '') { $path = 'madera'; } $dir = $base . "/" . $subdominio . "/" . $path . "/index.php"; if (file_exists($dir)) { include $dir; } else { echo "Ruta no existe: " . $dir; }