for example, I have mysite.com and beta.mysite.com . both point to the same index file using the virtualHost directive. what will i do in apache conf so that when accessing $_SERVER['SERVER_NAME'] value would still be mysite.com ?
mysite.com
beta.mysite.com
virtualHost
$_SERVER['SERVER_NAME']
it needs to be flexible to remove only beta .
beta
Perhaps you could use ServerAlias ββin your VirtualHost directive and use only one VirtualHost directive:
<VirtualHost *:80> ServerName mysite.com ServerAlias beta.mysite.com ... </VirtualHost>
http://httpd.apache.org/docs/2.2/mod/core.html#usecanonicalname
Try the following:
<VirtualHost *:80> ServerName mysite.com ServerAlias beta.mysite.com UseCanonicalName On </VirtualHost>
I assume that you have 1 VH, not: 1 for each site (since this is the same site).
Restart apache after.