Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Exclamation Load content from subdomain to mainwebsite

    Hi there,

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

    Examples:

    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

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    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...

    Code:
    <VirtualHost *:80>
        DocumentRoot /var/www/vhosts/mydomain.tld/
        ServerName www.mydomain.tld
        ServerAlias *.mydomain.tld
    </VirtualHost>
    I think that should work anyway, just a query, it's untested...

  • #3
    New Coder
    Join Date
    Jan 2010
    Location
    Birmingham, MI
    Posts
    98
    Thanks
    3
    Thanked 9 Times in 9 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •