Jump to content

Protecting Directory With Password


editor
 Share

Recommended Posts

I'm trying to protect a directory with a password through cPanel using .htaccess. I followed the tutorial provided in cPanel and thought that I had done everything correctly. However, I now find that I'm routinely receiving multiple prompts for username and password. In other words, when I try to access the directory, I'm prompted to enter my username and password. I do so and hit enter, only to receive another such prompt. Sometimes I need to repeat this procedure three times before finally gaining access to the directory. Does anyone know what I'm doing wrong?

Link to comment
Share on other sites

I'm trying to protect a directory with a password through cPanel using .htaccess. I followed the tutorial provided in cPanel and thought that I had done everything correctly. However, I now find that I'm routinely receiving multiple prompts for username and password. In other words, when I try to access the directory, I'm prompted to enter my username and password. I do so and hit enter, only to receive another such prompt. Sometimes I need to repeat this procedure three times before finally gaining access to the directory. Does anyone know what I'm doing wrong?

 

This can happen if there is a redirect on the server. I had this happen to me before and it turned out that I had to use a slightly different URL to avoid the issue.

 

Example:

 

causes failed login

http://www.mywebsite.com/lockeddir

 

works

http://www.mywebsite.com/lockeddir/

 

Regards,

Dan

Link to comment
Share on other sites

Never been a fan of using that. Everything you want to access in that directory requires a login/password to access.

 

What are you trying to do?

I was simply trying to protect the single file within that directory. I don't know why it didn't occur to me to try protecting THAT file rather than the whole directory. I've now done that and everything seems to be working well. Thanks for your input.

Link to comment
Share on other sites

This can happen if there is a redirect on the server. I had this happen to me before and it turned out that I had to use a slightly different URL to avoid the issue.

 

Example:

 

causes failed login

http://www.mywebsite.com/lockeddir

 

works

http://www.mywebsite.com/lockeddir/

 

Regards,

Dan

Thanks for the tip. Before I password protected the single file in my directory (see my reply to Bruce above), I tried adding the trailing slash and found that it did indeed eliminate the multiple prompts. Knowing this may be useful in the future. Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...