Blog · WebJi® India

How to Clone a WordPress Site

Quick answer: To clone a WordPress site, copy the files and the database to a new folder or domain, then rewrite the old address with a tool that understands serialized data. Take a full backup first. A clone on the same disk is not a backup, and a staging copy must stay out of Google.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Person at a desk watching several screens in evening light

When you should clone a WordPress site

Use a clone to test a plugin or a PHP upgrade, to open the same site on a new domain, or to start a second project from a build that already works. Do that only after a restore point exists.

Run take a website backup before you touch the live site. A clone is the copy you work on. The backup is the copy you put back if the clone fails.

The copy includes the theme, plugins, and uploads in wp-content, plus the MySQL database that holds posts, users, and settings. It does not move the domain registration, the mailboxes, or DNS. Those stay put until you change them on purpose.

  • wp-content: the theme, the plugins, and the uploads folder.
  • The database: posts, pages, users, menus, and widget settings.
  • A wp-config.php pointed at the destination database.
  • Not included: the domain name, mailboxes, and DNS records.

Duplicating one page in the block editor copies that page only. It does not copy the theme, the plugins, the media library, or the database.

Which method to use to clone a WordPress site

Pick one method and finish it. Mixing an installer from one plugin with a database from another leaves two half-copies.

MethodUse it whenWatch for
DuplicatorThe copy must move to another host or domainUpload both the archive and installer.php, then delete them
All-in-One WP MigrationThe site is small and WordPress is already installed at the destinationImport fails when the file exceeds the plugin cap or the PHP upload limit
Files and WP-CLIYou have SSH, or cPanel File Manager and phpMyAdminThe URL replace has to understand serialized data
Panel clone buttonBoth copies sit in the same hosting account and the installer shows CloneIt does not move the site off that account

The destination needs its own empty database. On WordPress hosting, create that database before you upload the copy. If you want WebJi® to move the site, email support@webji.services. Free migration is subject to terms and approval, and the work is quoted before you pay.

How to clone a WordPress site with Duplicator

Duplicator packs the site into an archive plus installer.php. The free plugin is enough for one full copy. Install it on the source site. The destination can be an empty folder. It does not need WordPress installed first.

Desk with several monitors in evening light
  1. On the source site install Duplicator, open Backups or Packages, and create a package. Name it with the site and the date.
  2. Run the scan. Fix any notice that would skip the database or the uploads folder, then build the package.
  3. Download both files: the archive and installer.php.
  4. Create an empty MySQL database and user on the destination. Upload both files into that account's document root, or into a subfolder if this copy is staging.
  5. Open installer.php on the new hostname. Enter the new database name, user, and password.
  6. Let the installer extract the files, import the database, and replace the old URL.
  7. When it finishes, delete installer.php and the archive. Log in at wp-admin on the new hostname and check the homepage, one inner page, the media library, and a form.

If any of those still show the old domain, stop and fix the URLs before you send the link to anyone.

How to clone a WordPress site with All-in-One WP Migration

All-in-One WP Migration exports one .wpress file from the source. Install a fresh WordPress and the same plugin on the destination, then use Import. Open Settings, Permalinks, and save once so the rewrite rules match the new address.

The import stops when the file is larger than the plugin's own cap, or larger than PHP upload_max_filesize and post_max_size. Raise those PHP limits, or switch to Duplicator or WP-CLI. Do not split the database by hand to squeeze past the cap.

How to clone a WordPress site with files and WP-CLI

This method uses no plugin. Copy the files, including wp-content, into the new document root. Export the database and import it into a new empty database. Point wp-config.php at that database name, user, password, and host.

On SSH, from the new site's folder, run a replace that understands serialized PHP. Skip the guid column so feed identifiers stay as they were.

wp search-replace 'https://old-domain' 'https://new-domain' --all-tables --skip-columns=guid

Then flush caches and save Permalinks. Without SSH, use cPanel File Manager and phpMyAdmin for the copy and the import. Still run a serialized-aware replace. Do not open the .sql file in a text editor and swap the domain.

WordPress stores many options as serialized PHP, and that format records the string length. A longer or shorter domain corrupts menus, widgets, and builder layouts while the homepage still looks fine.

How to transfer a WordPress site from one localhost to another

A move from one localhost to another is the same clone, with a folder name inside the URL. Copy the project folder into the other local web root, export the database, and import it into a new local database. Update wp-config.php.

Then replace the old local URL, folder included. localhost/client-a and localhost/client-b are different sites. A folder copy without the database gives you a theme and an empty WordPress. A database without the uploads folder gives you posts whose images 404.

Point the local server at the new folder before you test. Use the same serialized-aware replace you would use on a live domain.

How to fix URLs after cloning WordPress

The two addresses that matter are the WordPress Address and the Site Address, both under Settings, General. Media paths, menu links, and widgets that stored the old domain have to change with them.

Run the replace on a database you just imported, not on one a text editor already damaged. If that damage is done, drop the tables, import the dump again, and replace with WP-CLI or the migration plugin.

Check a post that has an image, a menu item, and a form. Broken images with a correct homepage usually mean the uploads folder never arrived, or the old domain is still stored on the attachment rows.

Cloning WordPress to staging versus a new domain

A staging copy lives on a subdomain or a subfolder. Do not point the public domain's DNS at it. Under Settings, Reading, turn on Discourage search engines from indexing this site before anyone can open the copy.

That checkbox is only a request. Keep the staging hostname off the public menu as well. A new domain is a different result: the URL replace is mandatory, and the site should be indexed only after you have checked it.

Same domain on a new server: skip the URL replace only when the domain string does not change. You still edit the database name, user, password, and host in wp-config.php.

On a shop, switch payment gateways off or into test mode, and stop customer emails, before you place a test order. The clone will charge a card and mail the customer if you leave those on.

On WebJi®, staging is part of managed WordPress hosting. Do not assume a one-click staging button on every shared plan. Email support@webji.services and name the plan before you tell a client the clone is included.

What breaks a WordPress clone, and the fix

Most failed clones come from a half upload, the old database password, or a URL replace that ignored serialized rows. Match the symptom before you start over.

What you seeUsual causeWhat to do
installer.php is blank or downloadsThe archive uploaded only in part, or PHP ran out of memory or timeUpload both files again and raise memory_limit and max_execution_time
Error establishing a database connectionwp-config.php still names the old database or hostEdit the database name, user, password, and host
Homepage loads, menus and images do notThe URL replace was skipped, or a text edit broke serialized rowsImport a clean dump and run a serialized-aware replace
White screen only on the new hostThe destination PHP version is older than the sourceMatch the PHP version in the host's selector, then reload
Both copies appear in GoogleThe staging hostname is indexableDiscourage indexing and do not submit that hostname
You cannot log in on the new copyThe browser is still opening the old hostnameUse the new hostname, or reset the user with WP-CLI

A clone you can open is still not a backup you can restore next month. Keep that second copy with WordPress backup, off the same disk as the live site.

Questions about cloning a WordPress site

How do I clone a WordPress site to another domain?

Copy the files and the database to the new account, then run a serialized-aware replace from the old domain to the new one. Log in on the new hostname and confirm Settings, General shows the new address. Delete installer.php and the archive when you are done.

Can I duplicate a WordPress site without a plugin?

Yes. Copy the files, export and import the database, edit wp-config.php, and run WP-CLI search-replace. cPanel File Manager and phpMyAdmin do the same job when you do not have SSH. Do not replace the domain inside the SQL file with a text editor.

Which plugin should I use to clone a WordPress site?

Use Duplicator when the copy has to move to another host, because it brings its own installer. Use All-in-One WP Migration when the site is small enough to import in one file. Neither plugin is a backup you can restore later.

How do I copy a live WordPress site to staging?

Clone onto a subdomain or a subfolder, discourage search engines, and do not point the public domain at that copy. On WebJi®, staging is stated on managed WordPress, not on every shared plan. Email support@webji.services and name the plan before you promise it.

Why do images break after cloning WordPress?

The database still points at the old domain, or a text replace damaged serialized rows so the media paths no longer parse. Re-import a clean database and run a serialized-aware replace. Also confirm the uploads folder actually arrived.

Is cloning a WordPress site illegal?

Cloning a site you own, or one a client asked you to copy, is a normal admin task. Copying someone else's text, images, or design into a new WordPress site without permission is a copyright problem. Do the first. Do not do the second.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →