Coconut oil will work to treat diaper rash but you also need to add some Shea butter to the coconut oil as well to create a diaper rash cream with coconut oil that will work.
You'll also need some arrowroot powder as well to mix in with the coconut oil and Shea Butter.