For many babies, just keeping things clean is enough. For others, use a barrier cream to prevent contact between skin and a soiled diaper.
For some babies, nothing except a clean bottom is needed to prevent diaper rash. Just simply change your baby when soiled, wiping with either a warm, moist cotton washcloth or a baby wipe. For others, however, even a normal amount of contact with a diaper (soiled or not) leads to a rash. For those babies, any commercially made diaper ointment or Vaseline is an acceptable barrier.
In the case of a baby or toddler with diarrhea, coat their bottom as if you are icing a cake as early as possible in the start of an illness! Apply a thick layer of your favorite barrier cream so the stool does not penetrate to the sensitive skin. When changing, wipe the top layers of cream off and reapply, but don't clean down to the bare skin with each change as to avoid more friction to the already sensitive skin. At bath time, you can gently wash all the remaining ointment away and then start again!