Recurrent urinary tract infections (UTI) can be fairly common in women. Reducing the risk of recurrent UTIs may involve identification of triggers and risk factors and avoidance.
Specific risk factors include sexual intercourse. This is why voiding (going to pass urine) immediately after intercourse is recommended. Also, do avoid spermicide use.
Increasing your fluid intake and not holding your urine for long periods of time is also recommended. Some (but not superbly strong) research has also demonstrated that cranberry juice may help to reduce the risk of E. coli (a type of bacteria) related UTIs.
If you have recurrent, frequent UTIs (>3x per year) despite these measures, you may potentially be a candidate for suppressive antibiotics taken on a regular basis to prevent these infections and may wish to speak to your doctor further about this.
Very rarely, there may be more serious underlying causes (e.g. structural abnormalities, abnormal connections between organs that should not exist) for your persistent UTIs so it is important to get a thorough evaluation if this has been an issue for you.