With just cpanel account You simply can NOT catch *.domain.com, unless someone ad into DNS * IN CNAME %domain.com%.
But it still wil be mapped on server not into Your account directort, but all *.domain.com are mapped into /usr/local/apache/htdocs
So basically the only way to catch *.domain.com traffic you need your own server.
In this case:
1.
In the /usr/local/apache/htdocs create a index.php like this:
<?
$host = $_SERVER["HTTP_HOST"];
$break = explode (".", $host);
$a = count($break);
$domain = $break[$a-2] . "." . $break[$a-1];
?>
<html>
<head>
<title><? echo $_SERVER["HTTP_HOST"]; ?></title>
</head>
<frameset rows="100%,*" frameborder="no" border="0" framespacing="0">
<frame src="http://<? echo $domain;?>/">
</frameset>
</body>
</html>
2.
Also need to edit httpd.conf:
-----
edit /usr/local/apache/conf/httpd.conf
.
.
DirectoryIndex index.php
.
.
(the Index.php must be first).
-----------------------
The reason is. default first is index.html and anytime whm updates, it put a new index.html
4.
With own server is good to have default DNS template:
DNS Functions/Edit Zone Templates/Standard
Make this template, than every new account will have default all *.domain.com set up:
-----------------------
; cPanel %cpversion%
; Zone file for %domain%
$TTL %ttl%
@ IN SOA %nameserver%. %rpemail%. (
%serial% ; serial, todays date+todays
14400 ; refresh, seconds
7200 ; retry, seconds
3600000 ; expire, seconds
86400 ) ; minimum, seconds
%domain%. IN NS %nameserver%.
%domain%. IN NS %nameserver2%.
%domain%. IN NS %nameserver3%.
%domain%. IN NS %nameserver4%.
%domain%. IN A %ip%
wwww.%domain%. IN A %ip%
www.%domain%. IN A %ip%
ww.%domain%. IN A %ip%
w.%domain%. IN A %ip%
localhost.%domain%. IN A 127.0.0.1
%domain%. IN MX 0 %domain%.
* IN CNAME %domain%.