Forum Moderators: phranque

Message Too Old, No Replies

htpasswd file asking to log in on every page

         

joeinnantucket

8:41 pm on May 25, 2010 (gmt 0)

10+ Year Member



Good afternoon everyone,
I hope someone can help me out, I tried searching before posting but couldn't find an answer.

I created a htpasswd file and added the code to my htaccess file but every time I go to a page, it asks for the log in, after I've logged in. The username/password never gives an error and if I click the cancel button on the log in form, it goes away and I can view the page. I was just wondering why it's asking me to always log in.

My code is as follows:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
require valid-user


Thanks for your help,
Joe

jdMorgan

9:44 pm on May 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This code will require the password for every requested URL-path that resolves to files in this directory, or in directories below this one, unless another .htaccess file in a lower-level directory overrides it -- say with "Satisfy any" and "Allow from all". So be sure it is located where you want it to be located.

If that's not the problem, fire up the Live HTTP Headers add-on for Firefox/Mozilla, and make sure that your browser is sending the auth credentials with every request after you have "logged in."

Beyond that, you could have code in your config or higher-level .htaccess files that is interfering, or a problem with domain canonicalization (e.g. www vs. non-www) that is interfering.

Jim

joeinnantucket

2:15 am on May 26, 2010 (gmt 0)

10+ Year Member



Thanks for the reply, I checked with Live HTTP Headers and the correct information is being sent. The login screen goes away if I check the box to remember my login information. I just never could figure out why it kept asking for the username and password. I had no other .htaccess files. If anyone has any other ideas, I would be grateful.

jdMorgan

2:38 am on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, I would definitely NOT recommend setting your browser to 'remember' your login, until you get this sorted out... This simply 'covers up' the problem -- but only for you.

Jim