title: prevent direct url access to php file
body: <p>I have a php file say <strong>"check.php"</strong> in my website and it is executed when a form is submitted.</p>
  
  <p>say my website is <strong>"myweb.com"</strong> and the php file is in a directory "PHP" </p>
  
  <p>I want to prevent direct url access to the "check.php" file i.e. if anyone types the url  "<strong><em>myweb.com/PHP/check.php</em></strong>" ,then the php file should not be executed and it should return a error message instead.</p>
  
  <p>I tried to prevent the access by setting a rule in .htaccess ,but it blocks the php even when I try to submit the form.</p>
  
  <p>.htaccess rule : </p>
  
  <pre><code>RewriteEngine on 
  RewriteCond %{THE_REQUEST} \.php[\ /?].*HTTP/ 
  (.*)\.php$ /index.html [L] 
  </code></pre>
  
  <p>Is there any possible way to do it ?</p>