I've only had a few migraines, and there's not much that I've found that works for them, although I've never tried prescription medication. I think that my triggers are lack of sleep or sometimes red wine -- but usually I'm okay with no sleep and some red wine.
As far as less serious headaches -- I usually have luck with Excedrin migraine, which is basically aspirin and caffeine. That seems to work for me, but I always have to take that with food or it will upset my tummy. If I don't have any Excedrin migraine, I've gotten by with plain old aspirin and a big old cup of coffee. Sometimes ibuprofen works, but only if it's not a really bad headache.