Once in a while, I notice that my diapers don't smell as "fresh and clean" as I think they should when they come out of the dryer. A few other cloth-diapering mamas I know have mentioned this lately also, so here are the best tips I've picked up for dealing with this:
#1: In the summer and whenever else possible, line dry your diapers. Drying in the sun virtually eliminates odors and most stains without any extra effort on your part - plus you are saving that much valuable energy and water at the same time (what could be better than that?).
#2: The next thing is to use less detergent in your wash cycles. Are you using the amount recommended on the bottle? If so then you are using 2x to 4x the amount needed. Sounds counter-intuitive, right? But in this situation, less is better. Only use 1/2 or even 1/4 the recommended amount of detergent in your wash cycles (I usually do two, one on cold and one on hot). If you suspect this is what's causing your diaper odor problems, wash your diapers with less detergent and then do a few extra washes with no detergent until you don't see any more bubbles going on in there - this ensures that any built-up soap residue is gone.
#3: Make sure you set your washing machine to cold-water rinses because rinsing with hot water can "lock in" any stinky odors.
#4: Do you use white vinegar in your rinse cycles? If so, try stopping for a couple washes or else cutting back on the amount you add (1/4 - 1/2 cup should do the job). If not, try adding some to your first rinse cycle. Adding vinegar to a rinse cycle is especially helpful if you already add baking soda to a wash cycle.
#5: Baking soda. This can help you or hurt you in the stinky-ness department. It adds to the cleaning power of your detergent, but if you add too much it can build up and cause odor just like too much detergent can. 1/4 - 1/2 cup in one wash cycle is probably enough. Like I said above, if you use baking soda, using white vinegar in a rinse cycle can help get all of it out.
But on the other hand, if you have stubbornly stinky diapers, baking soda can be your best friend. Wash your diapers thoroughly, and then set your washer to a pre-wash/soak cycle (or else just let it fill up all the way and then stop it). Stop it while it's on the "soak" part of the cycle so that it stays that way and doesn't drain, then add a cup or so of baking soda. Let it sit overnight, and then in the morning re-start the cycle so that it drains, and then do several rinse cycles (make sure you get all the baking soda out, again vinegar can help you with this).
As a last resort, bleach can be effective in eliminating odors from diapers. Use sparingly (about a 1/4 cup) for three reasons that I can think of - your baby's bottom, the environment, and your diapers. Make sure you rinse very thoroughly so that your baby's bottom doesn't get rubbed raw by any residue. Bleach damages the fibers of diapers (don't use it on waterproof covers), and therefore shortens their life span, so really try to use it only as a last resort.
If you have chronically stinky diapers and none of the tricks above work long-term, you may want to start experimenting with your washing technique. Are you soaking in a wet pail? Try a dry pail. Are you putting poopy diapers straight into a dry pail? Try rinsing and storing them in a wet pail, and so on. Also keep in mind that your baby's urine and poo may change in response to teething, colds, and lots of other things, and that can cause temporary stinky diapers sometimes.
Stinky diapers can be very frustrating -- believe me, I know! It is still a problem I face from time to time, but thankfully most of the time it can be fixed. Ideas and questions are welcomed!