RewriteEngine On
# [R] is in fact implied, since you redirect to a full url, but it's ok to leave them in
# QS ends in .html
RewriteCond %{QUERY_STRING} \.html$
# redirect to case-studies/%{QS}
RewriteRule .* http://case-studies.sitesell.com/%{QUERY_STRING}? [R,L]
# QS is not empty, but doesn't end in .html
RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} !\.html$
# redirect to %{QS}/case-studies
RewriteRule .* http://%{QUERY_STRING}.sitesell.com/case-studies? [R,L]
# anything else (ie: empty QS) should end up here...
# Force people to use www.
#RewriteCond %{HTTP_HOST} ^mikino\.com$ [NC]
#RewriteRule ^(.*)$ http://www.mikino.com/$1 [R=permanent,L]