SetEnvIf User-Agent ^EvilSearchEngine broken_crawler <Directory /usr/local/apache2/htdocs> Order Deny,Allow Deny from env=broken_crawler </Directory> You can restrict access based on the browser type or any other header information or connection property by using environment variables with Allow and Deny. In this case, browsers with a User-Agent header beginning with EvilSearchEngine will be denied access, and all others will be allowed. This is accomplished by using the SetEnvIf directive to conditionally set an environment variable named broken_crawler if the User-Agent header of the request (first argument) matches a certain regular expression (second argument). Later on, you can conditionally apply Deny and Allow directives based on the existence of that environment variable, identified by an env= prefix. Bear in mind that, although this technique will work most of the time, since the headers are sent by the client, headers cannot really be trusted. |