Fixed http/https check

Modified line 590 to address issue where $_SERVER is not empty, to redirect to https  not http