Skip to main content

Serving the same files to two different addon domains

Comments

5 comments

  • cPanelMichael
    I want addondomain.uk/community and addondomain.ie/community to remain distinct URLs but serve the same files.

    Hello, Have you considered configuring the addon domain names to have the same document root? You can modify the document root via the Addon Domains option in cPanel so that each domain name shares the same document root. Thank you.
    0
  • kadeo
    Hello, Have you considered configuring the addon domain names to have the same document root? You can modify the document root via the Addon Domains option in cPanel so that each domain name shares the same document root. Thank you.

    Hi, Thanks for the reply. I had considered that but its only the forum that that should be shared between the two domains. The rest of the pages on the sites will be completely different.
    0
  • cPanelMichael
    Hi, Thanks for the reply. I had considered that but its only the forum that that should be shared between the two domains. The rest of the pages on the sites will be completely different.

    You could still upload the separate pages to the same directory, or within a subdirectory of the document root. Otherwise, you may need to consider uploading a separate set of files to a separate directory for use with the additional domain name, and then setting up a cron job that copies over the files from the first domain name's document root to the second domain name's document root. Thank you.
    0
  • kadeo
    You could still upload the separate pages to the same directory, or within a subdirectory of the document root..

    Let's say I did that, what about the index.html at the root? If someone goes to addondomain.uk or addondomain.ie, wouldn't they get the same page then?
    Otherwise, you may need to consider uploading a separate set of files to a separate directory for use with the additional domain name, and then setting up a cron job that copies over the files from the first domain name's document root to the second domain name's document root..

    I don't think I understand. Do you mean like every time I make a change to the forum files on one site, run a cron job to update the other site? This would still mean I would have two sets of files doing the same thing. What kind of developer would I become if I didn't at least try and use DRY principles? lol Could subdomains help me here? If I set up a 'community' subdomain on both domains and have them both pointing to the same folder, could that do the trick? There will be some settings that would be individual to each site that I'll need to overcome somehow, like anything to do with a URL or email address.
    0
  • cPanelMichael
    Let's say I did that, what about the index.html at the root? If someone goes to addondomain.uk or addondomain.ie, wouldn't they get the same page then?

    Yes, that's correct. If you need separate index pages, then the better approach would be to use separate document roots and sync the shared files via a cron job using a utility such as rsync.
    Could subdomains help me here? If I set up a 'community' subdomain on both domains and have them both pointing to the same folder, could that do the trick? There will be some settings that would be individual to each site that I'll need to overcome somehow, like anything to do with a URL or email address.

    Yes, this approach would work. You could configure the same document root for both subdomains, and at the same time utilize separate document roots for the primary domain names so they can use their own custom files as well (e.g. index.html). Thank you.
    0

Please sign in to leave a comment.