PDA

View Full Version : How can I forbid access to folder(s)?


BarryD
03-19-2010, 02:03 AM
I'd like to prevent public access to a particular folder on my web site. For example, the image folder. If someone tries to gain access to a particular folder, I'd like them to see an Access Denied page. What sort of coding magic do I need to use here.
Thanks for any suggestions
BarryD

edbr
03-19-2010, 02:18 AM
if you domt want viewers to see what image files you want you coluld upload a blank index.html file. if you wanrt to restrict access with a password you can use .htaccess which may be featured on your hosting control panel
otherwise use php or the like to do it

davidj
03-19-2010, 04:34 PM
you could simply drop an index.htm in the directory to stop users navigating the directory. You could do this with a .htaccess file as well of course which is a better way

http://tools.dynamicdrive.com/password/

BarryD
03-21-2010, 12:25 AM
Thanks for these suggestions. I'll try each of these and let you know how it goes.

BarryD
03-24-2010, 10:39 PM
Thanks again. I've uploaded a blank index.html file in the directories I want to screen from view. This basically does what I want.
My host, Yahoo!, does not allow uploading of .htaccess files to my account. They have their own method for password protection in their Web Hosting Control Panel. I'm going to try this in the future.

davidj
03-25-2010, 01:11 AM
you could put a refresh metatag in these index files to bounce them out to the home page if they try to navigate to the directory

<meta http-equiv="refresh" content="0;url=http://yourdomain.com">

BarryD
03-25-2010, 02:52 AM
davidj: Very, very, extremely, cool. -Thanks a lot!

jaexavier
04-06-2010, 03:36 PM
If you do this from the command line on a Linux/UNIX operating system, you can do:

chmod 000

This will make the folder no access.

m1a2x3x7
04-06-2010, 08:17 PM
you should have directory browsing off on all your folders for security measures.

Goes to show how great Yahoo's hosting really is if this isn't set to default.

jaexavier
04-07-2010, 03:30 PM
Yahoo Hosting. Ah I see. Yes, they are meant to serve a general market and thus unix/linux commands don't apply.