Skip to main content

Display Content From primary.com When Visiting secondary.com Without Changing URL In Browser

Comments

8 comments

  • GOT
    All you really need to do here is set up secondary.com as a domain alias to primary.com and make sure you don't have any htaccess redirects that pushes content over to primary.com.
    0
  • jc4400
    My understanding is a domain alias would make both sites contain the content of primary.com. In my case, secondary.com is a unique website with its own content; we only want to share the "account" directory - primary.com/account - on both websites.
    0
  • GOT
    That's tougher for the reasons you encountered. Have you considered syncing the folder over from the other account? This is probably a better idea. Add sdcknday.com as a addon domain to primary.com that way they use the same user but have different docroots. Then your symlink would work fine.
    0
  • jc4400
    Where would symlink be recorded on the server when secondary is an addon? I do not see /etc/apache2/conf.d/userdata/ssl/2/secondary when secondary is an addon.
    0
  • GOT
    The symlink is at the file system level and does not need to be configured in Apache
    0
  • cPanelMichael
    Hello @jc4400,
    My understanding is a domain alias would make both sites contain the content of primary.com. In my case, secondary.com is a unique website with its own content; we only want to share the "account" directory - primary.com/account - on both websites.

    Are you attempting to replicate the account directory and have the data stored in a separate database for the separate domain name? Or, do you want both domain names to load and utilize the exact same content? Will the contents of this directory change or remain static? Thank you.
    0
  • jc4400
    Hello @jc4400, Are you attempting to replicate the account directory and have the data stored in a separate database for the separate domain name? Or, do you want both domain names to load and utilize the exact same content? Will the contents of this directory change or remain static? Thank you.

    Both domains would load and utilize the exact same content and use data stored in primary.com's mySQL database. Any content changes would occur on primary.com and those changes would appear on all domains. To put that another way: primary.com/account would be the only directory containing content. All secondary.com/account directories would be shells pulling content from primary.com/account
    0
  • cPanelMichael
    Both domains would load and utilize the exact same content and use data stored in primary.com's mySQL database. Any content changes would occur on primary.com and those changes would appear on all domains. To put that another way: primary.com/account would be the only directory containing content. All secondary.com/account directories would be shells pulling content from primary.com/account

    Hi @jc4400, In this case, you'd setup secondary.tld as an addon domain name with it's own document root. Within it's document root, you could setup a symbolic link pointing "account" to the "account" directory under the document root of "primary.tld". Or, another option is to setup the "account" directory as a source git repo, and then clone/sync the repo to the "account" directory for "secondary.tld": Guide to Git - cPanel Knowledge Base - cPanel Documentation Git Version Control - Version 76 Documentation - cPanel Documentation Thank you.
    0

Please sign in to leave a comment.