title: Apache2 - display auth only for public IP's, only on testing server
body: <p>I want to configure universal <code>.htaccess</code> file for my application to protect my testing server. I want to display basic auth for any request that comes from public IP, only if current server is testing.</p>
  
  <p>How to archieve this? I know how to protect domain and exclude some IP:</p>
  
  <pre><code>AuthType Basic
  AuthName "Please Log In"
  AuthUserFile /some/path/.htpasswd
  Require valid-user
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  Satisfy any
  </code></pre>
  
  <p>But how I can let this code run only if server is dev/testing? I can't change env variables. I thought about detecting domain (server that I want to protect is on subdomain), and place code from above in some sort of <code>if</code> block, but I don't know how. </p>