In cPanel, a primary domain is the main website associated with an account, while add-on domains are additional websites that can be hosted under the same account as the primary domain. The primary domain has its own directory on the server where it stores its files, and add-on domains are added as subdirectories within the primary domain's directory. Each add-on domain has its own separate content but shares the same hosting resources as the primary domain.
When you create an Addon domain, three changes occur in your account:
1. The new folder is created in the 'public_html' directory. This folder will be the root directory for your Addon domain's website files.
2. A subdomain is created for your primary domain and linked to the new folder. This subdomain acts as an alias for the Addon domain and routes traffic from the Addon domain to the appropriate folder.
3. The new domain name is associated with the subdomain, allowing visitors to access the website by using either the Addon domain name, the subdomain name or a combination of both.
For example, if your primary domain is 'example.com' and you add the Addon domain 'test.com', a folder named 'test.com' will be created in the 'public_html' directory. The subdomain 'test.example.com' will be linked to this folder, and the Addon domain 'test.com' will be associated with the subdomain. This means that all three of the following URLs will access the same website:
example.com/test.com/
test.example.com
test.com
It's worth noting that, from a visitor's perspective, accessing the website through the Addon domain name (test.com) will not show any evidence of the subdomain routing (test.example.com). Everything will appear and function as if the visitor is accessing a standalone website.
In conclusion, primary domains and add-on domains are essential aspects of cPanel, and understanding the difference between the two is crucial for managing your website. The primary domain and add-on domains are related in that they are both associated with the same hosting account. However, they are distinct from each other, with separate root directories. This allows you to host multiple websites within a single hosting account, which is convenient and cost-effective.