title: how to Protect Php file with the htaccess to protevent external use or a direct use
body: <p>If someone for exemple try to use my php script or an external use or also a direct use I want to deny him.<br>
  I have tried this in my htaccess : </p>
  
  <pre><code>RewriteCond %{HTTP_REFERER} !^$
  RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com(/)?.*$ [NC]
  RewriteRule \.(php)$ / [NC,R,L]
  </code></pre>
  
  <p>But it doesn't seem to be working, what I want is to allow the php script only when I call it in another page on my server.<br>
  The deny/allow way is also not perfect because it's possible to get the content of my php script by <code>CURL</code>.</p>