View Full Version : Question about htaccess password protection

08-31-2006, 04:51 PM
First I should let you all know that I am pretty new at using htaccess so I am learning as I go.

I am currently setting up a phpbb forum (which I have done several times) for a friend of mine who wants the whole forum protected with htaccess so that only people he wants can go to it. Yes I know that this is over kill and what not but I am trying to be accommodating . When I log into the protected area and then try to log into the forums I get the username and password prompt again. The people who will be using this are not that computer literate so having them do this login process once is asking alot as it is. Also I have noticed that clicking on a link within the forums, such as profile or logout, also pops the prompt up again. Is there a way to only have the prompt appear once? Or should I be doing this a different way?

Thanks in advance for any light you may shed on this situation for me.

09-02-2006, 12:59 AM
Where have you placed the htaccess file, and what is in it?

09-02-2006, 07:19 PM
I placed the file in the main directory of the forum installation. The file is as follows:

AuthType Basic

AuthName "Members Only!"

AuthUserFile "/home/***/.htpasswds/forum/passwd"

require valid-user

09-04-2006, 04:14 AM
What host does your friend have and what package does he have?

09-04-2006, 04:36 PM
How is that info gonna help?

09-04-2006, 04:52 PM
Because some hosts give their clients control panels that make password protecting a whole lot easier. It basically automates the process. CPanel being one of the most popular. Since you don't seem to know how to create the file yourself the control panel seems like the better option. Trust us, when we ask for something it does pertain to the question. I wouldn't ask something for no reason.

09-04-2006, 09:08 PM
The info I posted as what was in the htaccess file was done via cpanel. I apologize for answering your question with a question.

09-04-2006, 10:24 PM
Okay there are a few things you need to do before it actually works.
1. Login to Cpanel
2. Go to the Password Protection area in Cpanel.
3. Should be a list of folders and what not. Click on the folder name in this case you want to protect the root so click on the one with just a '/' or 'forums' whichever you want to protect.
4. Now on the next screen there should be a check box with some text next to it that says something like "Folder requires a password to access via http://", it may be a little different. Check this box then in the text input it wants a little title of the password prompt that comes up.
5. Once you enter that name hit save.
6. Once saved you can setup user names and passwords.
7. Just remember the stuff needs to be saved before you are able to add user names and passwords.

09-05-2006, 10:00 PM
I already did all that. My problem is that once in the forums area, clicking on a link such as "Logon" or "Members" the username and password prompt pops up again. So my real dilemma is do I need to not protect the entire directory and just the index.php file or do I need to add some code so that the login prompt for htaccess only appears once. Also just to clear something up...The phpbb install is not in the root directory. It is simply in addition to what is already existing. The phpbb install is in a subdirectory named "forum". I have been reading some tutorials and I briefly saw something about protecting a subdomain, would I be better off setting this up there and protecting the subdomain?

Thanks for all the help so far, I hope you all can help me figure this out because it is driving me nuts!

09-05-2006, 10:16 PM
You just need to put the .htaccess file in one directory. The directory with the forums. It seems like you may have created an htaccess file for all of the directories individually.