Stanly Simon Stanly Simon - 11 months ago 41
PHP Question

How to restrict folder content listing in php

I have a web application developed in PHP.
My requirement is to block a folder which contains uploaded documents.
For example, if a user click a document link on the application, it should open
if a user execute below url, it should block
I've tried .htaccess with Deny from all, but it is blocking everything.
Any solution for this senario ?

Answer Source

possible solutions:

  • place a file index.html or index.php in the directory
  • define in your httpd.conf Options -Indexes
  • place that line in .htaccess

personnally I prefer the 2nd line. There hardly ever is use for automatical listing of the files to a browsing visitor.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download