wildcard deal with www as a subdomain
- by Alaa Gamal
i am using wildcard with apache
my APACHE CONFIG:
ServerAlias *.staronece1.com
DocumentRoot /staronece1/domains
my named file
$ttl 38400
staronece1.com. IN SOA staronece1.com. email.yahoo.com. (
1334838782
10800
3600
604800
38400 )
staronece1.com. IN NS staronece1.com.
staronece1.com. IN A 95.19.203.21
www.staronece1.com. IN A 95.19.203.21
server.staronece1.com. IN A 95.19.203.21
mail.staronece1.com. IN A 95.19.203.21
ns1.staronece1.com. IN A 95.19.203.21
ns2.staronece1.com. IN A 95.19.203.21
staronece1.com. IN NS ns1.staronece1.com.
staronece1.com. IN NS ns2.staronece1.com.
staronece1.com. IN MX 10 mail.staronece1.com.
* 14400 IN A 95.19.203.21
*.staronece1.com IN A 95.19.203.21
my php test file
/staronece1/domains/index.php
<?php
function getBname(){
$bname=explode(".",$_SERVER['HTTP_HOST'],2);
return $bname[0];
}
echo 'SubDomain is :'.getBname();
?>
if i go to something.staronece1.com
i get this result SubDomain is : something
No the problem is
if i go to www.staronece1.com
i should get empty result, because www is not a sub domain
but i get this result
SubDomain is : www
And if i go to www.something.staronece1.com
i get firefox error message ( site not found )
How to fix this problem??
i think the solution is: added record for www in named file
Thanks