View Full Version : How do I protect a folder?

09-14-2006, 07:22 PM
Hi. Sorry if this has been asked before...

Got a site up and running. I have a special folder called say "Hideout" where I have some php files with passwords that are needed for a script to run.

I don't want anyone getting into or downloading the contents of Hideout.
However, I know there are programs out there like siteripper that can download all the files from a server...

I've already added a robots.txt file to disallow search engine robots, but how do I block everyone else from getting into this folder? Is there a way to basically block everyone or make the folder invisible?

Running standard cpanel, apache, shared hosting.



09-14-2006, 08:06 PM
Use .htaccess to password protect it.

So many sites out there showing you how to do this that you may as well just look through some of the sites on Google (http://www.google.com/search?hl=en&lr=&safe=off&q=htaccess+password).

09-14-2006, 08:39 PM
Is this a php include file or something? If it just has some php code in it thats ment to be included in another file, if you end it with a php extension, nothing will get sent to a user if they request the file.

Those siteripper tools can't download the file from the server before the PHP engine processes it.

09-14-2006, 09:24 PM
php: hypertext PREproccessor, as in BEFORE it gets sent to the client- as oracleguy said, if it has a php extension, there's no way that you can see the contents of it without having ftp access.

09-15-2006, 05:38 AM
Another thing you might do is put the folder outside of the publicly accessible directory tree for your site. For example, my publicly accessible root folder is:


I have my passwords folder located in: