usually with htpasswd does this its because you are accessing it with domain.com and you have a htaccess or something else redirecting to
www.domain.com
so you enter password for domain.com but then you need to enter it again for
www.domain.com
Id look into that