|
|
How To Prevent Or Allow Directory ListingsA very useful configuration is to prevent a directory listing where anyone
can see anything you have in there. Its not nice and you really shouldn't go
showing it anyway. To prevent directory listings, open your .htaccess file and simply add the following line to it:
The above line tells the Web Server to hide or prevent directory listings of
directories and files. The "*" is a wildcard meaning do not display any files. To prevent listing '.zip' files, here is the sample code:
The above line tells the Web Server to list all files except those that end with ".zip". To prevent listing multiple file types, and include the following line:
The above line tells the Web Server to list all files except those that end with ".zip", ".jpg" or ".gif". On the other hand, if your server does not allow it and you do want to show it, you can add the following code:
The above line tells the Web Server to enable directory listing. If you do show the directory content, only certain files or all of, you can make look nicer by including two files. Include a "HEADER" file which will dress up the top of the page. Anso you may include a "README" file which will dress up the footer area. Directory stuff will be shown in the sapce in between these two files. Review It
|
|
||||||||||