Go Back    Forum > Digital Publishing / Web Sites > Web Hosting Tutorials > cPanel

LinkBack Thread Tools
01-23-2012, 12:47 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
Join Date: Feb 2004
Posts: 4,319
Thanked 372 Times in 341 Posts
In the old days (the early 90s and before), one computer could host one domain. As you rightly guess, that was a waste of resources as computers became more powerful. So "virtual" hosting was the answer to that, known as "vhost".

How standard vhosts works

Each vhost had an account within a standardized user folder, and you could run as many vhosts on a computer as you needed. If you dig around a standard RHEL-type Linux install, you notice everything is in the /home folder, with subfolders for each account, which corresponds to a single domain. Any time you create a new domain, you generally make it a folder under home. The folder is usually either named after the domain or the vhost user (/home/domain.com or /home/myuser) -- and then all of the subsequent folders are underneath it, with both public and non-public domain/site data (i.e., /home/domain.com/public_html)

-- Plesk uses it's own /var/www folder instead of /home.
-- The same is true for Windows IIS, and the standard X:\Inetpub\ structure
-- Debian/Ubuntu vary a bit from the exact structure found in RHEL, but it's the same basic concept.

How cPanel vhosts works

cPanel does more of a voodoo workaround, using subdomains mixed with vhosting. It's not "true" vhosting, as far as I'm concerned. A cPanel account only gets access to one true vhost/user folder in Linux, but still allows the user to create multiple domains. The problem is that this setup opens up the potential for both security issues and duplicate content, if it's not setup properly by both the host and the user.

cPanel uses the "add-on domain" method:


Consider three domains from a single account: (1) myportfolio.com, (2) myblog.com, (3) myjokes.com

One is the main account's domain, and the other two are therefore add-on domains. Let's say I originally bought the web space to host my portfolio and resume, because I'm looking for a new job. Later on, I decide to add a blog, to share my rants and observations in life. And then let's say my Facebook feed gets so many likes and laughs that I decide to start my own joke site, which has everything from clean to crude jokes.

cPanel's structure looks like this:
  • /home/myuser(myportfolio.com)/public_html/
  • /home/myuser(myportfolio.com)/public_html/myblog.com/
  • /home/myuser(myportfolio.com)/public_html/myjokes.com/
... and "myuser" is essentially synonymous with the primary domain name, as was alluded to at the beginning of this post.

The DNS looks like this:
  • myportfolio.com
  • myblog.com
  • myjokes.com
  • www.myportfolio.com
  • www.myblog.com
  • www.myjokes.com
  • myblog.myportfolio.com
  • myjokes.myportfolio.com
  • www.myportfolio.com
  • www.myblog.myportfolio.com
  • www.myjokes.myportfolio.com
Yes, that means you can access add-on sites from the main domains !!!

Your sites can be access as both subfolders and subdomains:
  • myportfolio.com
  • myblog.com
  • myjokes.com
  • www.myportfolio.com
  • www.myblog.com
  • www.myjokes.com
  • myportfolio.com/myjokes.com
  • myportfolio.com/myblog.com
  • myblog.myportfolio.com
  • myjokes.myportfolio.com
  • www.myblog.myportfolio.com
  • www.myjokes.myportfolio.com
That's not good at all!

Google may show blonde jokes at the same domain as your professional portfolio. Your blog entries about politics or religion will be associated to your portfolio. That funny photo on your joke site will show up in a Google image search of your portfolio domain. You have to write .htaccess in order to block/separate the sites -- and from day one, if you don't want bleed-through of content to show up in search engines.

How to avoid domain crosstalk in cPanel add-on domains

The best solution is to use another folder for your domains -- not the cPanel default/home/user/public_html/
Instead, use something like /home/user/mydomains/

Unfortunately, some hosts disallow changing the default location. Even though it's a setting in WHM, they either incompetent or stubborn. Personally, I'd just assume switch hosts!

But there is one solution still ... dummy domains!

Instead of making myportfolio.com the main domain, use a domain you own -- but don't use. For example, if your name is John Smith, and your portfolio is johnsmith.com, also register johnsmith.us and use it as the dummy. Just own the domain -- don't set up any nameservers at the registrar. Just buy it and squat it. (Consider it brand protection, if nothing else.)

With a dummy domain (mydummy.com), cPanel's structure looks like this:
  • /home/myuser(mydummy.com)/public_html/
  • /home/myuser(mydummy.com)/public_html/myportfolio.com/
  • /home/myuser(mydummy.com)/public_html/myblog.com/
  • /home/myuser(mydummy.com)/public_html/myjokes.com/
And the DNS looks like this:
  • mydummy.com
  • myportfolio.com
  • myblog.com
  • myjokes.com
  • www.mydummy.com
  • www.myportfolio.com
  • www.myblog.com
  • www.myjokes.com
  • myportfolio.mydummy.com
  • myblog.mydummy.com
  • myjokes.mydummy.com
  • www.myportfolio.mydummy.com
  • www.myblog.mydummy.com
  • www.myjokes.mydummy.com
Since the main account does not connect, nothing will ever be shared between the accounts. Any attempts to connect to the DNS will results in an error to the lookup (which doesn't matter -- sometimes errors are fine).

There's also no rule that you must own the domain. You can use a domain that doesn't exist, if the shared host allows it. It's just safer to own the domain, in the unlikely event that somebody buys the fake/dummy domain. In the past, I've used owned dummy domains at Stablehost, Stream101, SpeedySparrow, Ninjalion, Crocweb and Semoweb. In each case, after sign-up, I simply informed the host of my dislike for the cPanel vhosts implementation, and listed out the domains I would be adding on once the account was set up. If it's your own VPS or dedicated server, then there's no host to disallow it, and you can do what you want.

Any flaws using the "dummy domain" method ?

There is one minor flaw in using dummy domains, but it's easily sidestepped. When you enable or disable Email Authentication in cPanel, the dummy DNS records cause an error. And it's not so much an "error" as much as cPanel is just confused.

You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.

You'll end up with this error after you enable DomainKeys and SPF records for the first time:

Status: Enabled, WARNING: DomainKeys cannot be used because this server is not a DNS server for mydummy.com [?]
Status: Enabled, WARNING: DomainKeys cannot be used because this server is not a DNS server for mydummy.com [?]
Pay close attention the URL of the enable and disable options. For example:
  1. Enable DomainKey: http://cpanel.host.com:2082/frontend/x3/mail/set_domain_keys.html?faction=install
  2. Disable DomainKey: http://cpanel.host.com:2082/frontend/x3/mail/set_domain_keys.html?faction=uninstall
  3. Enable/Disable SPF: http://cpanel.host.com:2082/frontend/x3/mail/set_spf.html
Note that the exact URL will vary from host to host. Pay attention. It's the end of the URL that matters most.

If you add a domain, after SPF and DomainKeys records are already "installed" (added to mail and DNS records), then you'll need to quickly disable/enable to catch the domains, and add authentication. That's just how the cPanel GUI functions. When using a dummy domain, however, it's often not possible to click the Disable/Enable buttons. You'll instead need to manually enter the URL into your web browser.


That's easy enough to do.

What you do not want to do, however, is not use SPF or DomainKeys/DKIM. Those records are what help to ensure your emails end up in a person's inbox, and not their spam folder -- especially when it concerns free and popular mail services like GMail, Hotmail, and Yahoo. With those records missing, free mail providers will generally divert your mail into the person's Junk/Spam folder -- and that's not good for you.

I hope this has been helpful and educational.

Need a good web host? — Read our 2018 Review of the Best Web Hosts
Quite often, problems with web sites are caused by having a rotten web host. Worse yet, many hosts try to blame you (the customer) for the problems! So dump that lousy company. Say goodbye to slow sites, unresponsive support techs, and downtime. Find yourself a new host today. Whether you need shared, reseller, VPS, semi-dedicated, cloud, or dedicated hosting, something on our list should be a good upgrade for you.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
The following users thank kpmedia for this useful post: tgjasper (12-03-2012)
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
08-02-2015, 10:43 PM
illumn8r illumn8r is offline
Free Member
Join Date: Jul 2015
Posts: 6
Thanked 0 Times in 0 Posts
Ok, but what if I have a bunch of sites already up and running in the usual cPanel way, is there a way to move them to the

way easily? Or would I have to backup the sites, delete them and recreate them under the better method? These are mainly WordPress sites.

Reply With Quote
11-08-2015, 01:02 PM
Stream101 Stream101 is offline
Free Member
Join Date: Feb 2013
Posts: 40
Thanked 0 Times in 0 Posts
You shouldn't have to at all. Your host should have no problem switching you to a "dummy" domain, while at the same time, creating you an addon domain and moving the content over accordingly. If your host knows what they are doing, it should be done really quickly and without anyone even really noticing.

Stream101 | Affordable Media Solutions | cPanel/WHM Reseller & Shared Hosting
Reply With Quote
07-19-2016, 09:26 AM
MikeDVB MikeDVB is offline
Free Member
Join Date: Jul 2016
Location: Central, Indiana, USA
Posts: 2
Thanked 1 Time in 1 Post
Send a message via AIM to MikeDVB Send a message via Skype™ to MikeDVB
I don't remember exactly when it became possible - it's possible it was available before we started - but with many quality providers you can simply create your addon domains outside of public_html.

The process is as simple as removing the "public_html" from the document root when adding the addon domain highlighted here in red:

You can even specify a folder like "domains" like so:

If this doesn't work - there is a good chance the provider has the following cPanel setting enabled:

It is off by default in the current version of cPanel and likely has been for a while. If you need to ask your provider to disable the setting you would ask them to change it in "WHM -> Tweak Settings" but do understand they're under no obligation to do this for you.

This doesn't solve the issue of cPanel using subdomains to identify addon domains and for tracking purposes like AWStats - but it helps.

What I personally do with all of my domains is via the .htaccess I check to make sure the site is being loaded on the proper domain and, if not, I re-direct to the proper domain permanently. The result is that if Google or another search engine somehow ended up on the site via the wrong subdomain/domain - it would be re-directed to the right location and would save the proper location.

Hopefully this helps!

Michael Denney - MDDHosting LLC
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spammer Dedication Thread (i.e. Sites to Avoid, Things NOT to Buy!) admin General Discussion 14 12-21-2013 12:37 AM
Remove unnecessary port access with CSF/LFD firewall in cPanel kpmedia cPanel WHM 0 01-12-2012 02:23 AM

Thread Tools

All times are GMT -5. The time now is 04:23 AM