Search This Blog

Wednesday, November 21, 2018

How to deny empty user agents using Apache

We can safely assume that empty user agents are evil and need to be blocked. They consume your server's resource and bandwidth, sometimes even crash your sites.

To deny empty user agents in Apache,  add the following in your .htaccess file.
SetEnvIfNoCase User-Agent ^$ keep_out
Deny from env=keep_out