title: Allow PHP file_get_contents but restrict all other public access to directory
body: <p>I have a directory of PDF files that nobody should be able to access, however the directory must remain in the webroot. I use <code>file_get_contents</code> to access the PDF files for use in my PHP scripts (ie. base64_encoding and protected downloads).</p>
  
  <p>I have tried different combinations of the following in my .htaccess located inside the directory, but it either restricts all access, causing the PHP script to fail, or allows full access for all users.</p>
  
  <pre><code>order deny,allow
  deny from all
  allow from localhost
  satisfy any
  </code></pre>
  
  <p>All PDF files have <code>-rw-r--r--</code> permissions and are owned by <code>apache</code> user.</p>
  
  <p>What should I put in my .htaccess file to prevent users from accessing the directory but allowing PHP scripts access?</p>