How to Change the Primary Domain of a Hosting Account Without Data Loss

45 views
Short answer: Replace old domain URLs with the new domain in your database using Better Search Replace plugin, then utilize 'Rename Domain' under DirectAdmin Domain Setup or migrate Document Roots in cPanel.

Comprehensive procedure for switching the primary root domain of an active hosting account without breaking database links or losing search rankings.

Before you start: Back up your site files and database and download the backup to your own computer. How to take a full backup

Quick reference

Recommended WordPress Utility Better Search Replace
DirectAdmin Interface Account Manager > Domain Setup > Actions > Rename Domain
cPanel Interface Domains > Create A New Domain > Document Root Relocation
Execution Time Under 15 minutes

Quick diagnosis

Scenario & Suspected Cause Immediate Action & Remedy
Too Many Redirects loop after rename Inspect wp_options table in phpMyAdmin to verify 'siteurl' and 'home' directives share exact matching protocols.
Broken asset URLs in page builders Re-run Better Search Replace targeting serialized Elementor and theme option metadata tables.

Steps

  1. Replace Database URLs First: Before touching server settings, install Better Search Replace in WordPress to swap old domain occurrences with the new domain across all database tables.
  2. Rename Domain in DirectAdmin: If using DirectAdmin, navigate to Domain Setup, click Actions > 'Rename Domain', enter old and new domain names, and apply.
  3. Provision New Domain in cPanel: In cPanel Domains, create the new domain with an isolated Document Root, then relocate public_html assets to the new directory.
  4. Inspect Configuration Files: Verify wp-config.php and .htaccess to confirm rewrite directives and constants map cleanly to the new domain string.
  5. Establish 301 Permanent Redirects: Deploy permanent 301 redirects from the legacy domain to the new destination to preserve organic search traffic.

Troubleshooting and tips

  • Always generate a full MySQL database dump via phpMyAdmin prior to initiating domain changes.
  • Re-issue free SSL certificates under SSL/TLS Status immediately after domain nameserver propagation.
Need more help? If you run into an error while following these steps, open a ticket with technical support and our team will look into it. Open a ticket
Was this article helpful?
No, I need more help
Didn't find your answer?
Under 3 minutes
Submit Support Ticket