To help prevent pyelonephritis if you have had a previous episode or are at risk:
Drink several glasses of water each day. Water discourages the growth of infection-causing bacteria by flushing out your urinary tract. This flushing also helps to prevent kidney stones, which can increase the risk of pyelonephritis.
If you are a woman, wipe from front to back. To prevent the spread of intestinal and skin bacteria from the rectum to the urinary tract, women should always wipe toilet tissue from front to the back after having a bowel movement or urinating.
Decrease the spread of bacteria during sex. Women should urinate after sexual intercourse to flush bacteria from the bladder. Some women who have frequent urinary tract infections after sexual activity can take antibiotics around the time of intercourse to prevent an infection.
If there is a structural problem with the urinary system, such as blockage from a stone, or a developmental abnormality, surgery can be done to restore normal urinary function and prevent future episodes of pyelonephritis.