The standard expression is Give [someone] what for. I think the other variants are all just mistakes or 'personal idioms', but perhaps someone will confirm if any of them really are normal in some region or dialect.
I agree with etymonline that the expression originated as a brusque reply to someone you've just assaulted, who says "What [did you do that] for?".
"I'll give you what for!" is often used in a context where the speaker (assailant) has every reason to think the other person knows perfectly well why he was attacked. It doesn't have to be in reply to anything at all.