I did the same.
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (strpos($user_agent, 'BingPreview') !== false || strpos($user_agent, 'Slackbot') !== false) {
header('Status: 403 Forbiden', true, 403);
exit(1);
}
source
share