Create a clone from one WordPress site to another in a few minutes

I have a problem with two websites. For example:

http://first.site

Read More

http://second.site

How can I make a clone of first.site to seconds.site? I want a method that I can do in a few minutes: does not involve changing the database, deleting it, create it, copying it, etc.

The clone must be exactly the same, except the domain, MySQL, and files (folders, images, etc.)

Related posts

Leave a Reply

2 comments

  1. Caveat

    This is extremely bad for SEO. Having duplicate content can ultimately cause your site(s) to be removed from search results.

    Solution

    This is actually pretty simple to have one database and disk content. Point both of the docroots to the same directory. Make sure each server name in your Apache config for each domain matches your domain name. Add this to your wp-config.php file:

    define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']); # no trailing slash
    define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME']); # no trailing slash
    

    Content URLs (images, media, etc…) will be sourced from the original domain, but will still work. Posting media on either domain will create a mix-match of URLs for guid and post_content. If you disable one domain, you would then need to find/replace all of those URLs in the database to keep them working properly. Do not hardcode JavaScript includes. Use wp_enqueue_script and wp_register_script so that you don’t run into XSS errors.

    Again, this is not a good practice, but WordPress is flexible enough to accomplish what you want.

  2. Hey I am using Duplicator plugin for that kind of stuff (cloning)

    https://wordpress.org/plugins/duplicator/

    It creates a zip and an installer.php file that you just put in the folder of the new server you want to clone the website. Then you run the process ,it is very simple and straightforward.

    If you just want the content from the first site a simple export of an xml file (posts,categories,tags etc) from the 1st site and import to the new site should work.