title: How to make sub folder exculsive access via sub domain only
body: <p>I have web site hosted on shared hosting account which is managed by CPanel. It allows to create unlimited sub-domains. I have the following situation:</p>
  
  <p>Suppose that my primary domain there is: mydomain.com
  My account's files are found on the hosting server at /home/myaccount/public_html
  I decided to make sub-domain named dir i.e dir.mydomain.com
  I created this sub-domain to use the following file:
  /home/myaccount/public_html/Hosts/directory</p>
  
  <p>Now I, successfully, able to access <a href="http://dir.mydomain.com" rel="noreferrer">http://dir.mydomain.com</a>
  However, I need to prevent the access <a href="http://mydomain.com/Hosts/directory" rel="noreferrer">http://mydomain.com/Hosts/directory</a> and exclusively restrict the access to the sub-domain.</p>
  
  <p>How could I achieve this using .htaccess?</p>
  
  <p>The following is a copy of the code I use in the .htaccess file found in /home/myaccount/public_html/Hosts/directory</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteRule    ^$    webroot/    [L]
      RewriteRule    (.*) webroot/$1    [L]
   &lt;/IfModule&gt;
  AddType audio/mpeg mp3
  AddType text/xml xml   
  </code></pre>