The easiest approach here is to configure a webserver on xxx.domain.com to 301 Redirect all requests to domain.com
For example:
https://tecadmin.net/nginx-redirect-https/
but adapted to something like:
server {
server_name xxx.domain.com;
return 301 https://domain.com$request_uri;
}