Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
Created May 20, 2015 15:40
Show Gist options
  • Save lyoshenka/65fde3b1a1f0e26c8651 to your computer and use it in GitHub Desktop.
Save lyoshenka/65fde3b1a1f0e26c8651 to your computer and use it in GitHub Desktop.
Kill all requests from bots in an emergency
<?php
if (preg_match('/(bot|spider|crawler)/i', $_SERVER['HTTP_USER_AGENT']))
{
header("HTTP/1.1 503 Service Temporarily Unavailable");
header("Status: 503 Service Temporarily Unavailable");
die(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment