nayen — 2011-09-22T09:24:22-04:00 — #1
My images folder currently lists all the images inside when I go to mysite.com/images. I want to prohibit direct access to the images folder. How can I have something like http://www.sitepoint.com/forums/images/ or http://w3schools.com/images/ ?
ralphm — 2011-09-22T10:06:03-04:00 — #2
Just put a file inside the images folder called index.html. It can be blank, or can have a message such as "Access Denied". But with that file in there, it's not possible to view the contents of the folder in the way you described.
nayen — 2011-09-23T03:05:58-04:00 — #3
Ralph, thanks for the quick answer. I have many subfolders in the images folder and it seems that I need to put an empty index.html file in every subfolder. Isn't there a better approach?
slicemee — 2011-09-23T21:24:41-04:00 — #4
also, if you are in a linux server you can prevent directory browsing via .htaccess
Options All -Indexes
logic_earth — 2011-09-23T23:11:00-04:00 — #5
You mean Apache...nothing to do with Linux.
slicemee — 2011-09-24T03:02:47-04:00 — #6
yes. Also, if it is nothing to do with linux you can try to include .htaccess files in Apache and Windows. Come here and tell me the results of yout attempt.
ralphm — 2011-09-24T03:21:17-04:00 — #7
It doesn't take long to do that, though. I just do it as a standard thing every time I create a folder.
nayen — 2011-09-24T03:33:32-04:00 — #8
Yes, this worked, thanks.
Ralph, even if it doesn't take any time I would always prefer a non-manual solution.
logic_earth — 2011-09-24T13:40:14-04:00 — #9
Works just fine on Windows. It works because it has nothing todo with the operating system Apache is running on.