Wood will rot when it is exposed to moisture and in contact with soil or other material which prevents the wood from drying out. The only (partial) exception is ground contact, pressure-treated lumber. However, even such "treated" lumber is usually not fully impregnated with wood preservatives and subject to some wood rot damage.
It is therefore very important to maintain a separation of six inches or more between all wood and any soil, gardening material, or firewood. All foundation posts must sit on concrete piers, and the perimeter foundation or skirting must be constructed out of concrete or pressure-treated lumber. All wood that has previously been in contact with soil, but which remains in relatively good condition, should be cleaned, allowed to dry out, and treated with a wood preservative. Wood that has deteriorated due to soil-to-wood contact must be replaced, and future soil contact prevented.