Posted on

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
Leave a Reply

Your email address will not be published. Required fields are marked *