How do I make players immune to cacti?

I want to make players with a specific selector able to stand on cacti without taking damage. I don't want to use silly workarounds like regeneration or resistance, because it feels like that would be unpolished and I still want them to take damage from other sources. I don't know if this is possible but I mine as well ask.
Continue to help post