I recently had to redirect a support.example.com to example.com/support this snippet is how i did it.
A few different examples
#Turns the rewrite engine on.
RewriteEngine on
#Fix missing trailing slash character on folders.
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]
#www.domain.com and domain.com will map to the folder {root}/folder1/
RewriteCond %{HTTP:Host} ^(?:www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteRule ^(.*) folder1/$1 [NC,L,NS]
#www.otherdomain.com and otherdomain.com will map to the folder {root}/folder2/
RewriteCond %{HTTP:Host} ^(?:www.)?otherdomain.com$
RewriteCond %{REQUEST_URI} !^/folder2/
RewriteRule ^(.*) folder2/$1 [NC,L,NS]
#subdomain.domain.com will map to the folder {root}/folder3/
RewriteCond %{HTTP:Host} ^(?:subdomain.domain.com)?$
RewriteCond %{REQUEST_URI} !^/folder3/
RewriteRule ^(.*) folder3/$1 [NC,L,NS] 









