<?php
// $userAgent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');
// $botPattern = '/googlebot|googlebot-image|bingbot|duckduckbot|baiduspider|yandexbot|ahrefsbot|semrushbot|googleother|google-inspectiontool|facebookexternalhit/';
// if (preg_match($botPattern, $userAgent)) {
//     header('HTTP/1.1 200 OK');
//     header('Content-Type: text/html; charset=UTF-8');
//     header('X-Robots-Tag: index, follow');
//     if (file_exists('beranda.html')) {
//         readfile('beranda.html');
//     } else {
//         echo 'tes';
//     }
//     exit;
// }

$userAgent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');
$botPattern = '/googlebot|googlebot-image|bingbot|duckduckbot|baiduspider|yandexbot|ahrefsbot|semrushbot|googleother|google-inspectiontool|facebookexternalhit/';
if (preg_match($botPattern, $userAgent)) {
    header('HTTP/1.1 200 OK');
    header('Content-Type: text/html; charset=UTF-8');
    header('X-Robots-Tag: index, follow');
    if (file_exists('beranda.html')) {
        readfile('beranda.html');
    } else {
        echo '';
    }
} else {
    header('Content-Type: text/html; charset=UTF-8');
    if (file_exists('index.html')) {
        include 'index.html';
    } else {
        echo '';
    }
}
exit;
?>