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 the apache conf so that when i access the $_SERVER['SERVER_NAME']
, the value would still be mysite.com
?
this should be flexible that only the beta
would be removed.
Maybe you could use a 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 this:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias beta.mysite.com
UseCanonicalName On
</VirtualHost>
I'm assuming you have 1 VH, and not: 1 for each site (since they are the same site).
Restart apache after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With