title: htaccess-protect a specific domain with password
body: <p>i have 3 domains:</p>
  
  <pre><code>example.com
  sub1.example.com
  sub2.example.com
  </code></pre>
  
  <p>all pointing to one server and one folder.
  i want to protect <code>sub1.example.com</code> and <code>sub2.example.com</code>from accessing the root folder with password, but <strong>not</strong> the main domain,it should be able to access root without password.
  i mean :</p>
  
  <pre><code>example.com      =&gt; allowed
  sub1.example.com =&gt; blocked with password
  sub2.example.com =&gt; blocked with password
  sub1.example.com/* =&gt; allowed
  sub2.example.com/* =&gt; allowed
  </code></pre>
  
  <p>* is a folder that can be anything.
  i tried to find it on the internet and here but i couldnt find any,how can i do this?</p>