subdomain redirected to domain.com

Is there a way I can 301 redirect the subdomain to the mapped domain? These was by default, I guess, before. Now both the subdomain and the domain are showing a 200 OK, which is duplicate content to Google.

Thank you