If you rub coconut oil on your stomach and it eases your constipation, that's not due to the effect of coconut oil. We usually feel relax and at ease when we're massaging our stomach. When you feel relax, you actually loosen your bowels.
Some might suggest it's due to coconut oil seeping through the stomach skin, thereby causing the constipation relief.
By the time it reaches your intestines, your skin could have absorbed and utilized most of the coconut oil for its own use. So, it's highly impossible to ease your constipation by simply rubbing coconut oil on your stomach.
The best and most effective way to relieve constipation with coconut oil is to eat it.