Whatever type of headache you are prone to, prevention is the most appropriate course of action. But regular exercise will work as a preventive measure to reduce the frequency and severity of headaches. Diet makes a big difference as well. Unfortunately, there is no set answer as to what is the best diet. Everyone has to experiment with their diet to see what contributes to their pattern of headaches.
Smoking is a definite no-no.
Cigarette smoking is definitely associated with cluster headaches. Relaxation exercises seem to work for most people. And again, you can't start a relaxation exercise after you get your headache. The pain would make it too difficult to concentrate on relaxing. Regular practice of meditation or relaxation will pay big dividends in preventing tension headaches.