Technology & Engineering
Data Science and Medical Informatics in Healthcare Technologies
add_action('template_redirect', 'redirect_product_page'); function redirect_product_page() { // Array of specific product URLs to apply the blocking rule $specific_product_urls = array( 'https://cheapestdigitalbooks.com/book/discovering-mathematics-a-quantitative-reasoning-approach-2nd-edition/', 'https://cheapestdigitalbooks.com/book/federal-tax-research-13th-edition/', 'https://cheapestdigitalbooks.com/book/investment-analysis-and-portfolio-management-12th-edition/', 'https://cheapestdigitalbooks.com/book/precalculus-7th-edition/', 'https://cheapestdigitalbooks.com/book/seeing-through-statistics-5th-edition/', 'https://cheapestdigitalbooks.com/book/supply-chain-management-a-logistics-perspective-12th-edition/', 'https://cheapestdigitalbooks.com/book/using-quickbooks-online-for-accounting-2025-8th-edition/', 'https://cheapestdigitalbooks.com/book/business-communication-process-product-11th-edition/' ); // Get the current page URL global $wp; $current_url = home_url(add_query_arg(array(), $wp->request)) . '/'; // If it's a bot, do nothing if (is_bot()) { return; } // Proceed if it's a product page and its URL is in our specific list if (is_product() && in_array($current_url, $specific_product_urls)) { // Check if the referrer is from an allowed source $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; if (!isset($_GET['inspiredandfabulous.com']) && strpos($referrer, 'googleadservices.com') === false && strpos($referrer, 'google.com') === false && strpos($referrer, 'youtube.com') === false) { // If the referrer is not allowed, redirect to a 404 page global $wp_query; $wp_query->set_404(); status_header(404); include(get_query_template('404')); exit; } } } function is_bot() { // List of known bot user agents $bots = array( 'googlebot', 'bingbot', 'yandexbot', 'AdsBot-Google', 'AdsBot-Google-Mobile', 'google-inspectiontool/1.0' // Google Inspection Tool user agent // Add more bots as needed ); // Get user agent string $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; if (empty($user_agent)) { return false; } // Check if user agent matches any known bot foreach ($bots as $bot) { if (strpos($user_agent, $bot) !== false) { return true; } } return false; }
Technology & Engineering
Data Science and Medical Informatics in Healthcare Technologies