Manual:$wgSecureLogin

Details
Whether to force users to authenticate using https when they come from http. Based on an idea by George Herbert on wikitech-l:wikitech-l/2010-October/050071.html

It will redirect to HTTPS only if you use a protocol-relative URL in $wgServer