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: 


Step 1: Added an A record to the mydomain.com domain zone of *.mydomain.com and had it point it to SERVERIPADDRESS.


Step 2: Add ServerAlias www.mydomain.com *.mydomain.com  to the httpd.conf file located in/usr/local/apache/conf/

Leave a Comment