How can I prevent a UTI? Drink lots of water. Doctors tell you to do this to stay hydrated anyway, but another advantage is that the additional fluids help flush out the urinary tract. You can also drink cranberry juice, eat fruit rich in vitamin C, or just take vitamin C supplements. This will increase the acidity of your urine, making it difficult for bacteria to stick to the walls of your bladder.
Always make sure to wipe from front to back after using the restroom and try to wear cotton panties (or panties with a cotton crotch) and loose-fitting clothes that allow the area to dry. Tight-fitting jeans (and the like) trap in moisture that allow bacteria to breed. And always, always be sure to urinate when you first feel the need.