title: .htaccess Allow All from Specific User Agent
body: <p>I have a website I am developing that is also going to be pulled into a web app. I have the following code in my <code>.htaccess</code> file to prevent access from ANYONE that is not on my allowed IP:</p>
  
  <pre><code>Order deny,allow
  Deny from all
  AuthName "Restricted Area - Authorization Required" 
  AuthUserFile /home/content/html/.htpasswd 
  AuthType Basic
  Require valid-user
  Allow from 12.34.567.89 
  Satisfy Any
  </code></pre>
  
  <p><strong>QUESTION:
  I would like to add an <code>Allow from</code> rule that will ALSO allow a specific HTTP user agent access to the site.</strong></p>
  
  <p>I found this code to redirect if not the user agent:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} !=myuseragent
  RewriteRule ^files/.*$ / [R=302,L]
  </code></pre>
  
  <p>But I can't seem to figure out how to turn this into an <code>Allow from</code> rule. Help?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found the code below to block specific user agents... I would instead like to say "if NOT <code>myuseragent</code>, then block."</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  SetEnvIfNoCase ^User-Agent$ .*(libwww-perl|aesop_com_spiderman) HTTP_SAFE_BADBOT
  Deny from env=HTTP_SAFE_BADBOT
  &lt;/ifModule&gt;
  </code></pre>