Skip to content
  • About
  • Contact
  • Docs
  • Features
  • Home

Configurations

5
  • Setup RAID Level 6
  • Setup RAID Level 5
  • How To Add Swap on RHEL or Centos based system
  • Website Migration to Non-Panel OpenLiteSpeed Server
  • Linux Server Performance Tuning

CyberPanel

9
  • Mounting /tmp on a Separate File
  • Updating CyberPanel Main VirtualHost Configuration
  • Updating CyberPanel vHosts Configuration
  • How to Change CLI PHP on CyberPanel
  • How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)
  • CyberPanel Server Cleanup: Logs, Dumps, Backups
  • CyberPanel Full LSPHP Installation PHP 7.4 – 8.3
  • CyberPanel / OpenLiteSpeed: Clean LSPHP Session Files
  • SSL Certificate Management in CyberPanel via SSH

Hestia Control Panel

6
  • Fixing Email Bounce Back Issue in Hestia (Exim4 Blacklist Rejection)
  • Managing Fail2Ban in HestiaCP Server
  • Installing and Configuring PHP Versions in HestiaCP
  • phpMyAdmin Not Found in HestiaCP
  • Setting Up a Reverse Proxy for any Port in HestiaCP
  • How to Install Let’s Encrypt SSL in Hestia CP (Hostname, Admin Panel, and Email Server)

WHM/cPanel

6
  • Setting Up a Reverse Proxy on cPanel/WHM for Port 8081
  • How to increase the size of the cPanel-generated /tmp filesystem
  • Installing Old PHP Versions on a cPanel/WHM Server
  • Fixing “550: Your Country is Not Allowed to Connect to This Server” Error in Exim (cPanel)
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Securing /tmp and /var/tmp with a Dedicated Loopback Filesystem

Nagios

5
  • Service Checks
  • Uptime Checks
  • Disk Space Checks
  • Load Checks
  • Email Related Checks

WordPress

3
  • WordPress Core Reinstallation Guide
  • Managing WordPress Users via WP-CLI
  • Website Duplication, Migration, or Domain Change

Operating System

1
  • Server Reboot (RHEL or Centos based system)

AWS

1
  • How to Resize EBS Volumes on AWS

Databases

2
  • MySQL
    • Optimizing MySQL Performance
    • Recovering MySQL in Plesk When InnoDB Crashes

CloudLinux

4
  • Moving cagefs-skeleton directory
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Enable bc in CageFS on CloudLinux Servers(WHM/cPanel)
  • How to Upgrade MySQL 5.x to MySQL 8.0 on CloudLinux (WHM server) with MySQL Governor

Cloudflare

1
  • Configuring Security Headers in Cloudflare

ISPmanager

1
  • Install Free SSL (Let’s Encrypt) for domain.tld on ISPmanager with NGINX

Plesk

1
  • Plesk Admin Login Blocked – IP Restriction Recovery Guide

VPN

4
  • Install OpenVPN Open Source in Linux CentOS Ubuntu Debian Servers
  • Protected: OpenVPN Installation & Fix Wiki (CloudLinux / CentOS 7 & 8)
  • Outline VPN Installation & Management Guide
  • Installing AdGuard Home on Debian/Ubuntu (Docker)
View Categories
  • Home
  • Docs
  • WordPress
  • Website Duplication, Migration, or Domain Change

Website Duplication, Migration, or Domain Change

This guide explains how to duplicate a WordPress website or migrate it between domains — either within the same server, across servers, or between different hosting panels.

📄 Scope of This Guide

This wiki applies to:

  • 🧳 Migrating between different domains on the same server.
  • 🔁 Moving a site from one cPanel account to another.
  • 🌐 Changing a domain name while keeping the same website content.

✅ Migration steps are the same across control panels — the only variation is in the document root and panel interface.

📂 Document Root Path by Control Panel

|    Control Panel            |               Document Root Path                                      |
| ———————————| ———————————————————————–|
| cPanel                              |       /home/username/public_html/                       |
| CyberPanel                    |       /home/domain.tld/public_html/                     |
| HestiaCP                         |      /home/user/web/domain.tld/public_html/ |
| Plesk                                 |      /var/www/vhosts/domain.tld/httpdocs/       |
|———————————————————————————————————–|

⚠️ Note: Always verify the actual path, as it may vary depending on the hosting environment.

Pre-Migration Checklist

Before beginning the migration:

  • ✅ Ensure the source domain is resolving and loading properly.
  • 💾 Confirm you have enough disk space on both the source and destination servers.
  • 🔐 Keep SSH or control panel credentials ready (WHM, cPanel, CyberPanel, etc.).
 🌐 Check if the Source Domain is Working

Open your web browser and visit:

http://domain1.com

✅ If the page loads correctly, you’re good to proceed.
❌ If not, resolve DNS or server issues first.

🛠️ Locate the Website Document Root (Source)

Log into your server via SSH or WHM Terminal and run:

grep domain.com /etc/userdatadomains

🔎 This will show the cPanel username associated with the domain.
📁 The typical path for cPanel users is:

/home/username/public_html/
Let’s Begin the Migration
Access the Website Directory

Navigate into the website’s directory:

cd /home/username/public_html/
📊Check Server and Website Disk Usage

To check how much disk space your files are using:

du -sch *

To check overall disk space available:

df -Th

⚠️ Make sure you have enough free space for the backup.

🔍Identify the MySQL Database

 

Run this command to view database credentials:

cat wp-config.php | grep DB

This shows:

define( ‘DB_NAME’, ‘example_db’ );
define( ‘DB_USER’, ‘example_user’ );
define( ‘DB_PASSWORD’, ‘example_pass’ );

🗃️Backup the MySQL Database

Use mysqldump to export the database and Use one of the following commands:

mysqldump -u db_user -p db_name > database.sql

Or:

mysqldump db_name > database.sql

Or with transaction-safe flag (recommended for live sites):

mysqldump --single-transaction db_name > database.sql

✅ This creates a file named database.sql with your full DB.

💡 You can also export the database using phpMyAdmin if you prefer a GUI.

Take a Full Backup of the Website Files

From the site’s root directory:

tar -czvf fullbackup.tar.gz *

📦 This archives all website files in the current directory.
Note: Check .htaccess (e.g., vim .htaccess) and if it’s customized, consider backing it up separately:

tar -czvf htaccess-backup.tar.gz .htaccess
 Optional: Exclude Unwanted Files from the Backup

To avoid backing up unnecessary data (like plugin backups):

tar -czvf fullbackup.tar.gz  --exclude=wp-content/ai1wm-backups --exclude=wp-content/updraft *

🧹 This skips large backup folders in the archive.

🎯 You can manually remove files using:

rm -rf unwanted_folder_or_file

Examples:

Remove old backup plugin folders
Delete large cache directories

Once the backup is complete, the file will be named `fullbackup.tar.gz`.

Fix File Permissions (for download or transfer)

If you plan to migrate the backup to another server, then correct the permissions and ownership. Once done, you can download it from the destination server.

chown username:group fullbackup.tar.gz
chmod 644 fullbackup.tar.gz
🌱 Create the New Domain on the Same or Another Server

Once created, access the newly created domain document root:

cd /home/newusername/public_html
Copy the backup:

If it’s the same server copy  the backup file

cp /home/username/public_html/fullbackup.tar.gz /home/newusername/public_html

If it’s a remote server, download it using:

wget https://domain.tld/fullbackup.tar.gz

🔁 Alternatively, use scp to copy via SSH:

scp user@oldserver:/path/to/fullbackup.tar.gz .
Extract the backup file

Move to new domain document root and Unpack the archive:

tar -xvf fullbackup.tar.gz

🗂 This will extract all files into the current directory.

🔧 Create the New Database

 

If using cPanel, create the database via the control panel. Otherwise, use CLI:

mysql -u root -p
CREATE DATABASE newdb;
GRANT ALL PRIVILEGES ON newdb.* TO 'newuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Once done, edit the `wp-config.php` with the new database details:

vim wp-config.php

Update:

DB_NAME

DB_USER

DB_PASSWORD

🧰 Import the Database

Import using:

mysql db_name < database.sql

Or:

mysql -u username -p dbname < database.sql

This loads the content from the backup into the new DB.

🔄 Update the Site URL (If Domain Changed)

If you’re changing domains, update URLs in the database.

Option 1: Using sed command:

cp database.sql database1.sql
sed -i 's/old_domain/new_domain/g' database1.sql
mysql -u username -p dbname < database1.sql

Option 2: Search-Replace Script (best for complex data)

git clone https://github.com/interconnectit/Search-Replace-DB.git
chown -R username:username Search-Replace-DB

Open in browser:

http://domain/Search-Replace-DB

🔁 Replace all old URLs with the new domain.

Test the Website

Open the new site in browser:

http://newdomain.com

🔎 Test pages, media, login, forms, admin panel.

Cleanup

After confirming everything works, remove sensitive files:

rm -f database.sql fullbackup.tar.gz

Also remove Search-Replace-DB tool:

rm -rf Search-Replace-DB
🎉 Migration Complete!

You’ve successfully duplicated or migrated your WordPress site.

Table of Contents
  • 📄 Scope of This Guide
  • 📂 Document Root Path by Control Panel
  • Pre-Migration Checklist
    •  🌐 Check if the Source Domain is Working
    • 🛠️ Locate the Website Document Root (Source)
  • Let’s Begin the Migration
    • Access the Website Directory
    • 📊Check Server and Website Disk Usage
    • 🔍Identify the MySQL Database
    • 🗃️Backup the MySQL Database
    • Take a Full Backup of the Website Files
    •  Optional: Exclude Unwanted Files from the Backup
  • Fix File Permissions (for download or transfer)
    • 🌱 Create the New Domain on the Same or Another Server
    • Copy the backup:
    • Extract the backup file
    • 🔧 Create the New Database
    • 🧰 Import the Database
    • 🔄 Update the Site URL (If Domain Changed)
    • Test the Website
    • Cleanup
    • 🎉 Migration Complete!

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest

Was it helpful ?

  • Happy
  • Normal
  • Sad
  • About
  • Contact
  • Docs
  • Features
  • Home

© 2026 Panel Web Hosting

  • About
  • Contact
  • Docs
  • Features
  • Home