Prevention is better than cure. So i'll just suggest you may have regular exercise like aerobic exercise,such as walking, swimming or biking.Exercise relieves stress, relaxes your muscles to reduce intensity of headache.
Headache can be treated at home. An effective method of relieving a headache is to apply an icepack on the affected areas; the icepack will reduce the temperature of the head and prevent a severe pain.