Setup a catch all domain

I needed to setup a catch all for one of my clients domains. This is what I needed to happen:

If user typed in an incorrect sub domain for mydomain.com that did not exist I needed it
to redirect them to www.mydomain.com. 

For example: if they type in notreal.mydomain.com it will send the user
to www.mydomain.com.

Here is what I did to accomplish this: 

Read more