Here are the safeguards I put into place for the birth of my second son:
Step #1 - Don't use a front facing baby carrier (e.g. Baby Bjorn), which can put pressure on both breasts (I got a double breast infection a day after I carried my first son around in a Baby Bjorn for several hours.) Instead, use a sling that takes the pressure off your breasts (e.g. Hotslings).
Step #2 - Drink a lot of water. Stay hydrated so that the fluids in your body are plentiful.
Step #3 - Don't wear underwire bras, or any type of bra that puts pressure under and around the breasts. I solved this problem by getting rid of ALL of my nursing bras and purchasing nursing camisoles instead. It took a little bit of getting used to because I was accustomed to more support from the typical bra. But I began to love the way the camisoles fit, and how they didn't apply pressure or dig in to my breasts. I tried several different brands of nursing camisoles while nursing my second son, but didn't discover my absolute favorite until my third baby. I highly highly highly recommend Bravado nursing camisoles. They are simply wonderful. They're comfortable, they don't shrink or get misshapen, the straps are sturdy, and I love the shape, which is much more flattering to the bust line than most camisoles.
Step #4 - Don't wait too long in between feedings. Feed your baby on demand. This helps to keep your breasts empty and your baby happy. Make sure your breasts are empty after feedings, especially if it will be a while before you nurse again (like right before bed). If your baby nurses but you still feel like you have some milk, pump it out with a hand pump (I love the Avent hand pump). I was initially concerned that doing this would increase my milk supply, causing engorgement more often, but I found that I didn't have to do this very often after the first few weeks, and keeping my breasts empty was vital for me to avoid infection, so it was worth it. It's also a good idea to pump if you wake up and find that you are very engorged, but your baby is still sleeping and may continue sleeping for awhile longer. If this happens, pump enough milk to soften your breasts and relieve the discomfort, then wait for the baby to wake up for the rest.
Step #5 - Don't allow your life to get overly hectic and busy. Sometimes this is unavoidable, but it must be noted that it was during jam-packed periods of life that I got breast infections. I'm sure there were several factors coming into play. When I was extra busy, I was drinking less water, nursing my baby less, getting engorged more often, etc. All of these steps really do go hand in hand as preventive measures against mastitis. This is an important step though, and I want to stress it because I think young mothers are pressured to be busy. I often see baby magazine articles that praise the busy mother who can juggle so many different things. While this is indeed admirable, I don't believe it's something to which we should aspire. Activities with a baby can be fun and enjoyable for mother and for baby, but I think it's even more important that the mother take care of herself and provide a peaceful home for her baby. This is when I've seen my children the happiest, and when I have felt the most peace. Not only has it been good for me, physically and mentally, to slow down my pace, but it has also been good for my kids. They have come to appreciate the structure and security of their lives, and then when we do have an interesting outing or activity, they look forward to it with energy and excitement rather than dread and burn-out.
These steps have been instrumental in protecting me from breast infections. I nursed my second baby for 14 months and did not have a single infection. I'm currently nursing my third baby. She is 8 months old, and I haven't had an infection with her either. These steps really do work!