title: Preventing a file being downloaded or accessed on a server
body: <p>I want to be able to prevent people from accessing a file on a server, such as a document if they were to directly link to it via the URL. This is for security purposes so that documents on the site just can't be stumbled upon and downloaded...</p>
  
  <p>What is the best approach for this?</p>
  
  <p>I've tried using the .htaccess to deny access to docs and txts for examples, but you can still download the files it just prevents you from accessing the directory...which isn't what I want to do.</p>
  
  <pre><code>&lt;Files ~ "\.(doc|txt)$"&gt;
    order allow,deny
    deny from all
  &lt;/Files&gt;
  </code></pre>