View Full Version : Multiple .htaccess protected folders

01-30-2004, 08:42 PM
Hi all - a newbie here.

I have a site with several folders that I would like to protect. I'm using the .htaccess protection method by simply making the folders "private". I want to be able to allow users access to all of these protected folders with a single login. As it is right now, each time they go to a protected folder, they have to re-enter the username and PW each time. Is there an easy way to do this?


01-30-2004, 09:16 PM
Yes. Create one main folder and put all of those folders inside that one. Then just have the login for the main folder.
And then for the .htaccess part which I assume you should already have this but for the benefit of others this is essentially what you would use:

AuthType Basic
AuthName "Title of your password protected area"
AuthUserFile /pathtoyour/htpasswd/file
require valid-user

and of course in your htpasswd file would be the username:password. And always make sure your htpasswd file is above the your web root directory or in some directory not accessible by the web.

01-30-2004, 10:01 PM
Thanks. However, I think I have a problem. Two of the folders have PHP based applications already installed and up and running (Coppermine Photo Gallery and phpBB). I'm afraid that if I move these folders, they'll get messed up and stop working. and I don't want to start these over again. Anything else I can try?

01-31-2004, 10:35 PM
Unless they are all under the same directory the user is going to get prompted to log in for each protected directory.

You can always just copy those other directories there and test things out leaving the originals in place. As for phpBB if any changes need to be made you can simply open the adminstrative control panel and adjust and directory paths that might be affected. I am not familiar with the Coppermine Photo Gallery but I am sure it probably either has an administrative control panel where you can adjust any settings or at least a configuration file you can open and adjust any settings that might be affected.