Extinction is the most effective way to eliminate undesirable behavior, although it is not the easiest way to deal with problem behaviors. Punishment is the old fall back position, but rather than eliminating the behavior, it drives it underground, to pop up whenever the punisher is gone or removed.
Extinction requires ignoring or redirecting the target behavior. Research has shown it to be the most effective and permanent way to change problem behavior.
Because the target behavior may be dangerous, it is sometimes necessary to physically make the behavior difficult if not impossible. That is especially true of head banging and other self injurious behaviors. Ignoring the behavior is not an option. That means the focus needs to be on replacement behavior, and redirection as a way to avoid the problem behavior.
A Functional Behavioral Analysis (FBA) may be necessary to identify the function of the behavior, and to identify a behavior that will have the same function. If the behavior is meant to get attention, the trick is to reward an alternate behavior with attention.

