View Full Version : regarding chmod and directory lists

09-05-2003, 02:53 AM
I want to set the permissions on my images directory so that my web pages can still load images from the directory. However, I don't want a user to be able to browse to my images directory and see a directory listing of all the files.

Is this possible? If so I can't seem to find the correct combination of numbers that make it do that. Whenever I change the permissions on the directory to give me a 403 error rather than a directory listing, my page also can't load the images anymore.

The page that would be loading the images is a PHP file...would that make a difference? Thanks.

Roy Sinclair
09-05-2003, 07:24 PM
Since you seem to be falling into the nether without a reply. I think you're looking at the wrong tool for the job. I don't know Apache or I could be a lot more specific but I think you should be looking at the .htaccess for that directory instead. I believe a rule set up in there is the key.

Try this link, it should get you the specifics you need: http://www.javascriptkit.com/howto/htaccess6.shtml

09-05-2003, 07:59 PM
Alternatively, you could place an empty index.html file in there. Usually a webserver (especially Apache) is set up to first look for an index.html (or similar file) and if none is found, display the contents of the directory. But Roy is correct, you can also set this up with .htaccess.

09-05-2003, 11:21 PM
I had considered making my own index file with a redirect in t or something...just wanted to know if there was a way to do it with chmod because I swear it was like that when I started on my current server and I did a chmod to make it the way it currently is.

I think I'm going to spend some time learning about .htaccess files because they seem pretty interesting. Thanks.:thumbsup: