There is an answer to the question of handling wild card subdomains, but it does not meet all my needs. I need to do all of these, supposing for example that the domain is example.com:
If the domain given is www.example.com it should 301 redirect to example.com because I do not want to have duplicate content that will create problems in search engines.
If the domain is anythingelse.example.com it should silently redirect to example.com so that software can pick up what subdomain was requested and act accordingly.
In addition, any specification after the domain name that does not refer to an actual file or directory should be redirected to index.php (again the software will figure out what it all meant). So anything.example.com/some/search/engine/friendly/specification should redirect to example.com/index.php.
I can get parts of this to work, but have yet to achieve the whole thing. Any offers!