Richard Foster has returned to Rangers after leaving Bristol City to agree a two-year contract with the Ibrox club.