There is really no good way to treat a hangover other than to avoid or limit alcohol in the first place.
That being said, for a hangover headache, apart from drinking fluids, eating, and resting, taking an over-the-counter NSAID like ibuprofen can usually do the trick. Although, take it with food and not too much, as it may upset your stomach. Also, some people cannot take NSAIDs due to underlying medical problems, so be sure it is safe for you.
In addition, it is important to avoid Tylenol (acetaminophen) when drinking alcohol, as the combination can lead to serious liver problems.
Finally, there are factors felt to increase the severity of a hangover, so minimizing them may help reduce the severity of your headache. These factors include:
Poor physical health
Smoking
Sleep deprivation
Congeners
Lack of food consumption and fluid intake
Increased physical activity while intoxicated
Your DNA (some people may be born with a predisposition to developing worse hangovers than others)