I don't know if this is a general problem or a particular issue with the way my
shared host is set up, but $wgServerName (and therefore the variables that
depend on it) is being calculated incorrectly.
The code picks the first variable from this list that is defined (falling back
on 'localhost' if none of them are):
$_SERVER['SERVER_NAME'] $_SERVER['HOSTNAME'] $_SERVER['HTTP_HOST'] $_SERVER['SERVER_ADDR']
My company wiki is located on a protected sub-domain at
http://internal.mydomain.com/wiki/. On our server the above variables are set
$_SERVER['SERVER_NAME'] = "www.internal.mydomain.com" $_SERVER['HOSTNAME'] = (not set) $_SERVER['HTTP_HOST'] = "internal.mydomain.com" $_SERVER['SERVER_ADDR'] = (IP address)
The order of checks mean that the automatically generated value is
"www.internal.mydomain.com" instead of just "internal.mydomain.com" as it should
be. Because of the .htpasswd protection we are therefore asked to login twice,
as these are treated as separate domains.
I experienced the problem in 1.5.6, but I've checked HEAD and the code for
generating $wgServerName has not changed.