You can also add your own 404.shtml file to redirect a page not found. Usually the cpanel has an icon to do that. Or do it manually.


for the .htaccess try this:
Code: 
ErrorDocument 404 /

 RewriteEngine On 
 RewriteBase / 
 RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.domain\.com$ [NC]
 RewriteCond %1 !^www$ [NC]
 RewriteRule (.*) http://test.domain.com/%1 [R=301,L,NC]