The primary treatment for a UTI is antibiotics. The type and duration of antibiotic treatment depend on the severity of the infection and the type of bacteria causing it. Pain relievers may also be prescribed to alleviate discomfort. Drinking plenty of water and cranberry juice is often recommended to help flush out the bacteria.