Urban Romans, we're told, took a bath every day. They did not use soap. Instead, they oiled themselves and scraped off the oil, along with the dirt, with strigils. What did they do about their hair, though? You can't use a strigil on your hair. Simply rinsing it in water would have resulted in plenty of dandruff and not much else: the hair would still be dirty and hanging in greasy strands. What did they use to get it clean?
They used lye soap which is made by combining ashes with lard or other oils and fats. This kind of soap was known from ancient Egyptian times. It was customary in Rome to always wash your hair on August 13th in honor of Diana, but they washed it other times as well, obviously. The Romans bathed a lot and they (especially the women) would wear little caps to prevent any unwanted water or oil from getting into their hair.
Caesar commented on the barbarians he fought in Gaul that they washed their hair with lime water which made it very coarse.