Veteran striker Hayles made his name with Fulham between 1998 and 2004, before spells at various other clubs took him to Leicester in January 2008.
The 37-year-old enjoyed two loan spells with the Robins last season, scoring four times in 12 league appearances in total, before being released by the Foxes.
Cheltenham manager Martin Allen told the club's official website: "Last season he scored some vital goals and his presence in the dressing room was significant. I am aware of his age but if we can manage him properly off the field then I'm sure he can help us to win some games."
Fellow striker Alsop, 36, is also enjoying a long career and spent his most prolific period with the Robins between 2000 and 2003, where he found the net over 40 times.
Having impressed while training with the club last week, he scored the winner in Saturday's friendly victory at Weston-Super-Mare. And Allen, who will continue to monitor his situation, added: "Julian will not train that often and we will wheel him out when we need him but I am sure he can be an effective player for us."