PDA

View Full Version : How to prevent directory browsing?



RedFish
September 1st, 2001, 22:25
How do I prevent directory browsing? Right now, if you go to www.red-fish.org/images for example, you see a listing of all the files in the folder - how do I keep that from happening?

The only way I know how is to put a dummy index.htm file there that has no content in the body. But I'm assuming there's a better way.

RedFish :confused:

Bruce
September 1st, 2001, 22:43
Create a .htaccess file with the following:



Options -Indexes

jon787
September 1st, 2001, 22:50
If you can't use an .htaccess file place a index.html file in the directory. By default a webserver will serve this file up to a browser.

RedFish
September 1st, 2001, 23:37
Originally posted by Phrozen
Create a .htaccess file with the following:



Options -Indexes


:jump: Whee! Thanks Phrozen. Knew there had to be a simple solution.

Okay, so now a follow-up question. I've got the .htaccess file in the root (public_html) folder, and it's doing exactly what I wanted, giving a 403 Forbidden error message when I try to go to www.red-fish.org/images now.

But is this normal as part of the error message?:
"Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

Do I need to set up some sort of ErrorDocument or do something else?

RedFish