fix bug where $_SERVER['SERVER_NAME'] was set incorrectly

closes #765