View Full Version : Load content from subdomain to mainwebsite

07-26-2011, 07:07 PM
Hi there,

May i know is it possible to make my website load from all my subdomains?


i put a index.php file in my public_html and when people go to www.example.com it will automatically pull my website data from subdomain such as sub.example.com

Please let me know if it is unclear for you.

Thank you

07-26-2011, 09:48 PM
I'm not entirely sure what you are asking. If you want the same files to load regardless of what sub-domain is accessed there are a couple of solutions. One solution would be a catch all domain...

<VirtualHost *:80>
DocumentRoot /var/www/vhosts/mydomain.tld/
ServerName www.mydomain.tld
ServerAlias *.mydomain.tld

I think that should work anyway, just a query, it's untested...

07-29-2011, 06:34 PM
You don't necessarily even need to deal with Virtual Hosts, although you can do it that way. If the main domain is the default server document root, all you need to do is point the DNS 'A' record to the IP address of the server machine for the main domain.