My son was also a head banger, the harder the surface, the better. I tried everything, ignoring him, loads of attention, being cross, but it didn't deter him, then I started to throw a small amount of water over him when he was down, and he did not continue for too long after that. He will be 8 years old next week, and has no memory of it at all.
Once, when we were out with his 3 year old sister, he was 21 months, and his newborn sister, and he fell out of the trolley and knocked himself unconscious. I rushed him to hospital, and I was so scared that they were going to find an old skull fracture when they did the x-ray. But he was fine, and they don't hurt themselves enough to cause real damage, just enough to scare you.
I hope he stops soon.