code added to replace http with https if ssl enabled