lucy24 - 9:28 pm on Oct 1, 2013 (gmt 0)
Do you get enough requests for the (nonexistent) m. subdomain that you want to capture and redirect them, rather than simply let the DNS send out a "can't find it" error messsage? This should probably be answered first, before you get into the how-to.
A subdomain redirect can definitely be done in htaccess. It's one rule with one condition. In fact if you currently have subdomains, it may be a simple matter of eliminating any rules that pertain to the subdomains, leaving only the domain-name-canonicalization redirect.
But if it's your own server, you don't need to bother about htaccess. If you can't face the DNS issues, you can put the identical RewriteRule in your config file.
This is assuming you're on a setup that currently allows wild-card subdomains and there's no way to disable this feature. Otherwise it would make more sense to enable only those subdomains you actually use, or formerly used. From your post, it doesn't seem as if you have any.
to go to the www. of my domain. (no subdomains at all)
If you want to be hair-splittingly technical, www. is a subdomain. By convention it is treated as synonymous with the bare domain.