title: .htaccess not blocking specified user agent
body: <p><strong>UPDATE</strong>
  I found the Firefox addon: User Agent Switcher which allows me to test with a different user agent. Surprise, it blocked the user agent as it should. I wonder why the 12 or so requests which took place after my first block attempt via <code>.htaccess</code> somehow slipped in. Were the page requests already in process? Oh well, at least they are working.</p>
  
  <hr>
  
  <p>In my <code>.htaccess</code> I have a php script that checks for offending user agent strings and dynamically writes to <code>.htaccess</code> a <code>RewriteCond</code> to immediately block the user agent. </p>
  
  <p>I tried to block the agent <code>Mozilla/5.0 (Auto Shell Spider)</code> by writing the following condition <code>RewriteCond %{HTTP_USER_AGENT} ^.*(Mozilla/5\.0\ \(Auto\ Shell\ Spider\)).*$ [NC]</code> but my log showed the user agent continued to access pages (another 10+ over the next 2 seconds). I've tested the rule with <code>preg_match()</code> and it matches and therefore should block the user agent. What is happening? 
  I am under the impression that I don't need an <code>AND</code> in the <code>RewriteCond</code> since each has its own <code>RewriteRule</code>. I don't believe there is caching of <code>.htaccess</code> - changes should take effect immediately. Is php regex different from htaccess? </p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Here is a more complete set of <code>.htaccess</code> instructions:</p>
  
  <pre><code>RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php
  
  # Block spiders: 
      RewriteCond %{HTTP_USER_AGENT} ^.*(Baiduspider|360Spider|Sogou|Sosospider|Yandex|NaverBot|Yeti|moget|ichiro|RedBot|AhrefsBot|xovibot).*$ [NC]
      RewriteRule .* - [R=403,L]
  Deny from 59.61.184.100
  Deny from 59.152.240.71
  
  # Block User Agent -  NOT WORKING?
  RewriteCond %{HTTP_USER_AGENT} ^.*(Mozilla/5\.0\ \(Auto\ Shell\ Spider\)).*$ [NC]
  RewriteRule .* - [R=403,L]
  </code></pre>
  
  <p>When using php preg_match, </p>
  
  <pre><code>$text =  "Mozilla/5.0 (Auto Shell Spider)";
  preg_match('`^.*(Mozilla/5\.0\ \(Auto\ Shell\ Spider\)).*$`', $text, $acell);    
  echo "&lt;pre&gt;";var_dump($acell);echo "&lt;/pre&gt;";    
  </code></pre>
  
  <p>I get a match as follows:</p>
  
  <pre><code>array (size=2)
    0 =&gt; string 'Mozilla/5.0 (Auto Shell Spider)' (length=31)
    1 =&gt; string 'Mozilla/5.0 (Auto Shell Spider)' (length=31)
  </code></pre>