At last I found the problem. Due to some complicated proxy problem, the $_SERVER['hostname'] became the second name and that is used in the redirection meganism of vbulletin. Makes me wonder why this hostname is used anyway.... why not make the urls relative?