Replies: 3
Hello, thanks for supporting a great plugin!
Due to the big problem of the influx of bots, is it possible to create a condition in the plugin?
The cache works for “good” bots and disables the cache for visits with an empty referrer.
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$down_reg = mb_strtolower($_SERVER['HTTP_USER_AGENT']);
$down_reg = str_replace(array(' '), '', $down_reg);
$find_bot_step1 = str_replace(array('yandex', 'google', 'pinterest'), ' this_is_bot! ', $down_reg);
$find_bot_step2 = explode(' ', $find_bot_step1);
if (isset($find_bot_step2[1]) == "this_is_bot!") {
return true;
}
Here we catch an empty referrer and disable the cache (!empty($_SERVER["HTTP_REFERER"])) {
It is necessary to send all bots for verification, otherwise it will not work.