title: php restrict access to files in directory
body: <p>I am trying to restrict direct access to files in a directory. So for example i have 
  website.com/files/example.flv.</p>
  
  <p>So if users go straight to the file in the URL, i want them to be redirected to the home page.</p>
  
  <p>I have tried the following using htaccess</p>
  
  <pre><code>deny from all
  </code></pre>
  
  <p>but its not working great. Is there a way i could do this using php, then in the user goes straight to the file in the url, they will get redirected.</p>
  
  <p>So if the user goes to the file link in the url, they will be sent to the home page. So can this only be done using htaccess</p>