From the perspective of a cyclist, what is a common way to hydrate throughout the day?
Very unlikely you were dehydrated from such a short ride. If you were dehydrated post ride, you almost certainly started out dehydrated.  Humans evolved to the top of the food chain by drinking when thirsty, the advent of the '8 glasses a day, drink all the time' has been popularized in my lifetime (First references appear to be a 1945 FDA recommendation), is controversial and largely debunked.
Worth a read.. but this is just one of thousands saying the same thing .
(https://www.med.umich.edu/1libr/Gyn/ObgynClinic/8GlassesWaterMyth.pdf)
What I believe has happened is some people have lost the ability to listen to their body and know when its time to drink, and are so used to drinking a measure amount to a clock they now mistake the sensation of thirst for dehydration.
So how much to drink....
Drink when you are thirsty.  Use the color of your urine to tell you if you are drinking too much or too little.  Personally, if I am about to head out on a long event then I preloading a day or two before - Buts thats mostly because I tend to not drink enough, so the conscious effort is need to ensure I do not start out thirsty.
With all that out the way, say you really were dehydrated, not just hungover (which is mostly dehydrated with toxic by products of metabolized alcohol), had Covid19 or one of many other medical conditions that cause headaches, what to do...
Rehydrate with water if its mild. If you want to rehydrate quicker, or it is moderate, rehydrate with an isotonic drink. Do NOT consume energy drinks, they use more water than they provide.  Drink until you pee, then drink another litre is a reasonable point. You are recovered when your pee returns to normal color.
If the dehydration is severe, then you need medical intervention, likely a saline drip (Speaking from experience, magic, but like any medical procedure, negative side effects are always a possibility so should be avoided whenever possible)