RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^BadBot.* RewriteRule .* - [F] #### RewriteMap robotmap dbm:/path/to/file/map.db RewriteCond %{HTTP_USER_AGENT} !="" RewriteCond ${robotmap:%{HTTP_USER_AGENT}|NOT-FOUND} != NOT-FOUND RewriteRule .* - [F]