Copy a WordPress Site to Another Location
- Log into cPanel.
- Create a subdomain of the testing website – e.g. testsite.example.com.
- Launch File Manager from cPanel and ensure the option to show hidden files is set to on.
- Navigate to your WordPress root directory and copy your WordPress files from your current directory to the subdomain root directory you created, usually the same name as the subdomain itself.
- Choose ALL WordPress files.
- Warn! When selecting your WordPress files, ensure that the folders for subdomains and addon domains, as well as all other folders that are not WordPress folders, aren’t fixed. After you click the Select All button, hold on to the Ctrl keyboard button and select the folders that aren’t being moved so that they are not highlighted prior to copying files. If you’re using an Apple computer, you’ll need the Command key for similar things.
- Click Copy at the top of File Manager.
- Type the path to the new subdomain document root folder.
- Copy the .htaccess file. This file should be placed in the same place you’ve copy-pasted your WordPress files or in the root of your new location. The .htaccess file could contain crucial references to the existing WordPress installation. In accordance with the setup you have set for your installation, you might have to search for this file within the root directory of the account. For instance, InMotion Hosting normally uses the document root “public_html.” Check this place to find the .htaccess file if you could not find it in the location of installation for your WordPress website.
- Create a database. This is used to distinguish your test site from your primary website. If you are using the same database on the test site and live site, it will reflect the changes made to that test site. The use of a different test site database will prevent this.
- Export your current database.
- Import your existing database into the new database that you created.
Configure Test Site
- Modify the Test WordPress wp-config.php file for the test website. This ensures that the site is running on the latest database.
- Modify the domain and home URL of this test website into the subdomain test in order to make changes to your WordPress database.
- The correct image links since they are in the database, but are not linked to the URL of the website.
Enhance WordPress by incorporating the security features and correct mixed content errors to allow SSL (HTTPS) use with Simply SSL.
Why You Might Need to Clone Your Website
There are many possible scenarios in which you may have to copy your website.
From the simplest updates of themes and plugins to and including complex theme customization, the advantages surpass the time it’ll require by ten times.
Certain scenarios include:
- Themes and plugins are updated and up-to-date, as well as testing compatibility
- Modifying themes and plugins
- A child theme can be added by adding a theme
- Changing PHP versions
- Updating WP Core
- Adding additional functionality through plugins
- Modifying themes and plugins
- Transferring a copy your website to a technical team to help troubleshoot
- Modifying your Domain Name
- Changing Web Hosts
- There are many more things too.