title: Domain name specific code blocks in htaccess
body: <p>We have local servers, central dev, staging and production servers. However the dev and staging are password protected for obvious reasons. So after deploying any changes to the htaccess i have to manually edit the htaccess file to enable the password protection on the dev and staging server.</p>
  
  <p>Is there any way to have conditional blocks based on domain name like:</p>
  
  <pre><code>if ( $domain == "dev.example.com" || $domain == "staging.example.com" ){
    AuthName "Password Protected Area"
    AuthType Basic
    AuthUserFile /somewhere/.htpasswd
    Require valid-user
  }
  </code></pre>
  
  <p>I need to find the htaccess equivalent of the condition:</p>
  
  <pre><code>if ( $domain == "dev.example.com" || $domain == "staging.example.com" ){
  
  }
  </code></pre>
  
  <p>I would appreciate the any help or pointers you guys can give.</p>