title: Allowing Access to Only a Specific Path in .htaccess
body: <p>I have the following in my .htaccess file:</p>
  
  <pre><code>&lt;Files *.php&gt;
      Order Allow,Deny
      Deny from all
  &lt;/Files&gt;
  
  &lt;Files index.php&gt;
      Order Allow,Deny
      Allow from all
  &lt;/Files&gt;
  </code></pre>
  
  <p>The above code is to restrict access to only the index.php file. However, the problem is that if there is another index.php file under a subdirectory, then that index.php file is allowed to get executed as well. This is not what I want. I want something like:</p>
  
  <pre><code>&lt;Files /home/user/public_html/index.php&gt;
      Order Allow,Deny
      Allow from all
  &lt;/Files&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;Files /home/user/public_html/admin/index.php&gt;
      Order Allow,Deny
      Allow from all
  &lt;/Files&gt;
  </code></pre>
  
  <p>(I just want 2 index.php files to be executed)</p>
  
  <p>But the above doesn't work, as it'll deny the execution of the should-be-allowed index.php (again, there are two that should be allowed, one under the root directory of the website, and another under the admin folder).</p>
  
  <p>Does anyone have any tips on how to do this?</p>