title: Block bot/spider via htaccess
body: <p>I'm trying to block Baiduspider via htaccess but it still gets through. </p>
  
  <p>Here's the full useragent of the Baiduspider that doesn't respect the robots.txt and isn't turned away by htaccess:</p>
  
  <pre><code>Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
  </code></pre>
  
  <p>Here is what I have in robots.txt to try to block him (I know this one is most likely not the real Baiduspider and the impersonator won't respect robots.txt:</p>
  
  <pre><code>User-agent: Baiduspider 
  Disallow: /
  </code></pre>
  
  <p>Here is what I have in htaccess to deal with him. Is there something incorrect in this or would someone suggest a better alternative?</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [NC]
  RewriteRule .* - [F]
  </code></pre>
  
  <p>I also tried this in htaccess and it still didn't solve it:</p>
  
  <pre><code>SetEnvIfNoCase user-agent "^Baiduspider" bad_bot 
  &lt;FilesMatch "(.*)"&gt;
  Order Allow,Deny
  Allow from all
  Deny from env=bad_bot
  &lt;/FilesMatch&gt;
  </code></pre>