I have been using cloth diapers since I had my first child, about 4 years ago. In that time, I have learned a lot about using cloth diapers, but I never felt like I mastered how to keep them clean until just recently.
Let me share what I have learned about cleaning cloth diapers.
As my diapers get dirty, I throw them either directly into the washing machine with water or into my wet/dry bag. When I am ready to do a load of diapers, I wash them once in the hot cycle and rinse. Then, I add a little bit of my diaper safe detergent and run them through the heavy wash cycle again. When they get to the rinse cycle, I add 1/3 cup of baking soda. The baking soda really does the trick in getting the urine smell out and neutralizing the acid in the diapers. If you want, you always rinse them out a third time after the baking soda cycle.
After they are all clean, I try my best to hang them on the clothes line in the sun, instead of putting them in the dryer. This helps bleach any stains out and is gentler on the fabric than the dryer.
One thing to note: if you don't have any baking soda or want an alternative, you can also use vinegar, but I wouldn't recommend using both.