Você pode excluir cada sub1
, sub2
individualmente assim;
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub1\.domain\.com [NC]
RewriteRule ^(.*) - [L]
RewriteCond %{HTTP_HOST} ^sub2\.domain\.com [NC]
RewriteRule ^(.*) - [L]
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
</IfModule>
Ou apenas especifique que você deseja redirecionar apenas domain.com
para www.domain.com
com o RewriteCond
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
</IfModule>