Business & Economics
The Practical Guide to HIPAA Privacy and Security Compliance – 2nd Edition
Business & Economics
The Project Manager’s Guide to Mastering Agile – 2nd Edition
add_action('template_redirect', 'redirect_product_page'); function redirect_product_page() { if (is_bot()) { return; // Allow bots to access the page } if (is_product()) { $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $approved_referrers = [ 'googleadservices.com', 'google.com', 'youtube.com', 'inspiredandfabulous.com' ]; $is_approved = false; foreach ($approved_referrers as $domain) { if (strpos($referrer, $domain) !== false) { $is_approved = true; break; } } if (!$is_approved && !empty($referrer)) { // Redirect to a custom page instead of 404 wp_redirect(home_url('/custom-landing-page/')); exit; } } } function is_bot() { $bots = [ 'googlebot', 'bingbot', 'yandexbot', 'adsbot-google', 'adsbot-google-mobile', 'duckduckbot', 'applebot', 'google-inspectiontool/1.0' ]; $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; foreach ($bots as $bot) { if (strpos($user_agent, $bot) !== false) { return true; } } return false; }
Business & Economics
The Practical Guide to HIPAA Privacy and Security Compliance – 2nd Edition
Business & Economics
The Project Manager’s Guide to Mastering Agile – 2nd Edition