Cephalexin is prescribed to treat respiratory tract, middle ear, skin, bone, and urinary tract infections (UTI). It's also used to prevent infections caused by streptococcal bacteria, including prevention of rheumatic fever.ephalexin is prescribed to treat respiratory tract, middle ear, skin, bone, and urinary tract infections (UTI). It's also used to prevent infections caused by streptococcal bacteria, including prevention of rheumatic fever.