Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carl-alberto/80afe6f382d2625f16ae5dfdcc94950f to your computer and use it in GitHub Desktop.
Save carl-alberto/80afe6f382d2625f16ae5dfdcc94950f to your computer and use it in GitHub Desktop.
Block user agents
$blockAgents = array('AhrefsBot','AspiegelBot', 'MJ12bot');
foreach ($blockAgents as $agent) {
if (strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) {
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment