I get headaches from riding when it is hot too. This year (we have already had several days in the high 90's) I started taking sudafed before I ride and I think it has helped. In the past I when I have gotten a headache riding I take sudafed, advil and an elctrolite replacement drink and the combo seems to help more often then not.
Jones