Here is a "horibble example" I am pulling from something off the wall. the point is there is syntax that will allow you to use wildcards and such. I am on vacation, and I don't have time to research it right now/ If I can in the next day or two I will try to get you a better example. But here is some syntax along the lines of what you want:
RewriteRule aw(.*)/index.htm$ xxx.php?aw$1/
RewriteRule aw(.*)/index.phtml$ gys.php?aw$1/
This is from some code I found on a website that was using 'illegal' keyword redirects. Where it comes from is not important. If you Google 'rewriterule htaccess' you will find examples of how to turn the stuff before the domain (zzzz.domain.com) into a variable that you put after it like this:
Rewriterule (*.)mydomain.com mydomain.com/$1
That would (if written correctly) take anything before mydomain and put it after the slash instead. Again, I don't know the syntax, just the concept and that you can do it. You can use wildcards but you can also do the specific ones you want really easily, something like:
Rewriterule abc.mydomain.com mydomain.com/abc
You can find examples of it by googling what I said.
And the 301 if not what you are after. In the syntax you have it would redirect any 301 it finds (if there was one) to the url you have entered. This is not what you want. You want the Rewrite as I said above with something like [R 301] after it, which will tell google that it is permanrnt. And you don't reallly need that. The user accessing it does not need to know it is changing. That is something your program (including .htaccess) is handling, just like WP handles stuff without the user knowing.