Client Area

How to Fix DNS Errors When Recreating an Addon Domain in cPanel That Was Previously Created with "Share Document Root" Option

4 min readPublished 4 Mar 2026Updated 14 Apr 2026944 views

In this article

  • 1What Is the "Share Document Root" Option
  • 2What it Does:
  • 3Common Problem Scenario
  • 4Root Cause Explained
  • 5Step-by-Step Fix (with Examples)

When adding an addon domain in cPanel, many users unintentionally enable the "Share document root with primary domain" option. This setting can cause hidden DNS conflicts and directory overlaps, especially if the domain is deleted and later re-added with its own document root.

This detailed guide walks you through resolving the (XID...) A DNS entry already exists error -- step by step, with guaranteed results.


What Is the "Share Document Root" Option

When adding an addon domain in cPanel, you'll see this checkbox:

 Share document root (/home/username/public_html) with "primarydomain.com"

What it Does:

  • Both domains point to the same directory

  • No new folder like /public_html/exampleaddon is created

  • Useful for domain aliases, not separate websites


Common Problem Scenario

  1. User adds exampleaddon.com with "Share Document Root" enabled

  2. Later removes the domain from cPanel

  3. Tries to re-add it with a separate document root

  4. Gets this error:

(XID abc123) A DNS entry for "exampleaddon.com" already exists.

Even though the domain was deleted, DNS entries still exist, causing this conflict.


Root Cause Explained

When the domain was first added with shared root:

  • Its DNS A record was saved in the primary domain's zone file (/var/named/primarydomain.com.db)

  • This DNS record is not removed when the addon domain is deleted

As a result, re-adding the domain triggers a duplicate DNS entry error.


Step-by-Step Fix (with Examples)

Step 1: Search for Leftover DNS Entries

Use the following SSH commands:

grep -Ri "exampleaddon.com" /var/named/
grep -Ri "exampleaddon.com" /etc/named.conf
grep -Ri "exampleaddon.com" /var/cpanel/userdata/
grep -Ri "exampleaddon.com" /etc/userdomains

If you find any of these:

rm -f /var/named/exampleaddon.com.db
sed -i '/exampleaddon.com/d' /etc/userdomains

Step 2: Manually Edit Primary Domain's Zone File

nano /var/named/primarydomain.com.db

Look for and delete lines like:

exampleaddon.com. 14400 IN A 123.45.67.89

Save and exit the file.


Step 3: Clean the cPanel User Cache (Even If You Don't Know the Username)

If you're still getting the error, the domain might be referenced in one of the cPanel user files -- even after deletion.

Don't Know the cPanel Username

Run this command to find out which user has a hidden reference to the domain:

grep -Ri "exampleaddon.com" /var/cpanel/users/

You'll get output like:

/var/cpanel/users/someuser:XDNS1=exampleaddon.com

Now, replace someuser in the commands below with the actual username you found.

Option 1: Manual Cleanup Using nano

nano /var/cpanel/users/someuser

Delete any line like:

XDNS1=exampleaddon.com

Then rebuild the user data cache:

rm -f /var/cpanel/users.cache/someuser
/scripts/updateuserdatacache
/scripts/rebuilddnsconfig
/scripts/rebuildhttpdconf

Option 2: One-Line Command to Remove the Reference (No nano)

sed -i '/exampleaddon.com/d' /var/cpanel/users/someuser && \
rm -f /var/cpanel/users.cache/someuser && \
/scripts/updateuserdatacache && \
/scripts/rebuilddnsconfig && \
/scripts/rebuildhttpdconf

This safely removes the domain reference and refreshes all configurations in one go.


Step 4: Restart DNS & Web Services

Depending on your DNS system:

PowerDNS:

systemctl restart pdns

BIND (named):

rndc reload

Also restart essential services:

/scripts/restartsrv_httpd
/scripts/restartsrv_dnsadmin

Step 5: Recreate the Addon Domain Properly

Go to: cPanel Domains Create a New Domain

  • Enter: exampleaddon.com

  • Uncheck: "Share document root with primary domain"

  • Set Document Root: /public_html/exampleaddon


Why You Should Avoid "Share Document Root"

Risk Impact
Shared .htaccess Redirect loops, conflicting rewrites
SEO Conflicts Duplicate content, indexing issues
SSL Confusion Certificates for one domain may interfere with the other
Migration Trouble Harder to separate later

Best Practice: Always use a unique document root per domain.


Summary Checklist

Step Action
1 Remove stale DNS and config entries
2 Manually edit primary zone file (.db)
3 Clean /var/cpanel/users/ and users.cache
4 Restart DNS and Apache services
5 Add domain again with separate root

SEO Keywords

cPanel addon domain error, DNS entry already exists, shared document root, PowerDNS conflict, WHM DNS troubleshooting, addon domain recreate fix


Need help Reach out to our expert support team at https://www.domainindia.com/support

Let us handle the conflict while you focus on your business.

Was this article helpful?

Your feedback helps us improve our documentation

Still need help? Submit a support ticket