Created
May 20, 2015 15:40
-
-
Save lyoshenka/65fde3b1a1f0e26c8651 to your computer and use it in GitHub Desktop.
Kill all requests from bots in an emergency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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