反转mod_rewrite规则

我想redirect访问

http://www.domain.com/test.php?sub=subdomain&type=cars 

 http://subdomain.domain.com/cars 

我已经有了mod_rewrite规则来做相反的事情:

 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{HTTP_HOST} !^(www)\. [NC] RewriteCond %{HTTP_HOST} ^(.*)\.(.*)\.com [NC] RewriteRule (.*) http://www.%2.com/index.php?route=$1&name=%1 [R=301,L] 

我需要对这些规则进行哪些更改以将请求从脚本redirect到子域?

 RewriteEngine On RewriteCond %{QUERY_STRING} ^sub=(.+)&type=(.*)$ RewriteRule . http://%1.domain.com/%2?