How to redirect all subdomains to root domain?

Hello everyone.

I want to redirect all subdomain to root domain.

I have installed wordpress using Openlitespeed and Digital Ocea.

Then I added * hostname in DO Domain panel and added *.domainname in openlitespeed listener.

Its working on some subdomains but showing SSL error before redirecting.

Someone please guide me.