Hugs. We just went through this with our youngest. My other two kids didn't do this. She kept doing it mostly with her brother. But after many times letting her know it was not ok to do that and signing hurt she has stopped doing it. I know it has helped a lot more now that she is signing what she wants and we haven't seen her do headbutts the last two weeks.
She is 18 months old.
What I did was first move her away from her brother. Sat her down on the floor and talked to her. Sometimes she would go right back to it and I would sit her on the floor in front of me and tell her again it was not ok to do that and used the sign for hurt to let her know that it will hurt her head. Also used it to let her know it hurt her brother, and she would stop. Not sure if this will help you. It has worked for us so far. Good luck.
M. mom to 3 kids