If possible, you should define a "Wild-card" DNS record for your domain, so that *all* possible subdomains will resolve to your server. Typically, it would look something like:
Having done that, add a 301-Redirect to redirect requests for all resources at all non-canonical hostnames to the same resources at the canonical hostname.
If you have a unique IP address for your server (whether it's on shared hosting or not), then you should be able to do all of this yourself. If you share an IP address with other sites hosted on the same server, then you may have to ask your host for help in order to get wild-card subdomains working.