So, I am new to the world of cPanel. How does cPanel's addon domain feature work? Does it utilise Apache Web server's VirtualHost feature? Or does it do something else?
It simply creates a directory for each add on domain and directs traffic to it. If you have an existing domain example.com and you want to add example-1.com, it creates another directory example-1.com at your root. It then creates multiple paths to your domain, http(s)://example-1.com and http(s)://example-1.com/example.com. If you're using a CMS like WordPress, you can then install WordPress directly in the new directory.
See image below:
-
2"...and directs traffic to it" - but "how" - that would seem to be what the OP is asking, rather than simply what it does. (Aside: You wouldn't expect
http(s)://example-1.com/example.com
to be accessible, perhapshttp(s)://example.com/example-1.com
, ifexample-1.com
is created as a subdirectory off the main domains document root - but that isn't necessarily the case - in fact, that is often best avoided by using a directory outside the main domain's document root.) – MrWhite Apr 30 '20 at 15:29 -
-
@MrWhite it actually does do a
http(s)://example-1.com/example.com
(I have 3 add on domains in my system). I should clarify, that it's not a directory within the website (i.e., it's not visible like a virtual directory)., but a directory within the user's parent file system directory. – Trebor Apr 30 '20 at 23:33 -
@Trebor it's a directory within public_html right? And how does tee server know which Web page to serve for a request? Does it utilise Apache Web server:a VirtualHost function? Or does it do something else? – lpydawa May 1 '20 at 2:30
-
@lpydawa, doesn't have to be, unless you want it to be. Domains can be at the same directory level as public_html (not inside). During domain creation, you can specify the document root. See
https://www.inmotionhosting.com/support/domain-names/adding-addon-domains-in-cpanel/
– Trebor May 1 '20 at 3:32