RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain\.mysite\.ru$
RewriteCond %{REQUEST_URI} !/subdomain/
RewriteRule ^(.*)$ /subdomain/$1 [L]
RewriteEngine On
RewriteRule ^([a-zA-Z]+)/ - [L]
RewriteCond %{HTTP_HOST} ^(.*)\.mysite\.ru$
RewriteCond %{DOCUMENT_ROOT}/%1%{REQUEST_URI} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R,L]
RewriteCond %{HTTP_HOST} ^(.*)\.mysite\.ru$
RewriteRule (.*) %1/$1 [L,QSA]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.mysite.ru$
RewriteCond %{HTTP_HOST} ^((.*)\.)mysite.ru$
RewriteRule ^/(.*) /%2/$1