How to rewrite this URL with htaccess
Code:
http://domain.com/subDomain/file.ext?anything
to
Code:
http://subDomain.domain.com/file.ext?anything
and return a 301 code?

Thanks.