Wild Card Domain Redirection
Target
Setting up wild card to redirect *.yourdomain.com to yourdomain.com i,e. anything.yourdomain.com will be redirected to yourdomain.com
First create a .htaccess file in the document root folder of the domain yourdomain.com. so anything.yourdomain.com will be redirected to yourdomain.com and below is the .htaccess file to achieve this condition.
DirectoryIndex index.html Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC] RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
Anything that stats with *.domain.com eg: xxx.domain.com xyz.domain.com will be redirected to domain.com
Reference
URL: http://www.webmasterworld.com/forum92/3660.htm