title: How to prevent users from accessing files directly from url?
body: <p>I have a php file called <code>home.php</code> that uses <code>main.php</code> in its code. Both are in the same directory. I don't want people from accessing <code>main.php</code> by typing it in the url like: <a href="http://localhost/main.php" rel="nofollow noreferrer">http://localhost/main.php</a></p>
  
  <p>The code in .htaccess is:</p>
  
  <pre><code>&lt;Files main.php&gt;
  order deny,allow
  deny from all
  &lt;/Files&gt;
  </code></pre>
  
  <p>But this is preventing <code>home.php</code> also from accessing <code>main.php</code>.</p>
  
  <p>Can anyone help me with this?</p>