This post enumerates 10 error free steps to clone Magento store into a new folder in the same hosting server. Cloning your Magento store into a new folder means you either you want to view the clone as a subdomain or as a subfolder:
Main Goal
The main goal of these steps is to let you and your team view an exact live working copy within 1 to 2 hours. Therefore, knowing how to use cPanel and working with installed Magento files is a must.
10 Steps to Successfully Clone Magento Store
- First, create the subdomain or add a new folder in the root directory of your site.
- Next, using cPanel’s Code editor, open your existing Magento store’s /app/etc/local.xml file. Take note of the database name and database user.
- Open phpMyAdmin and duplicate the database.
- Find the database name from the left column of phpMyAdmin then click on it.
- Click the Operations tab from the top menu.
- Type a name for the clone database.
- Make sure you select the same three highlighted options as shown in my screenshot below.
- Click the Go button.
- Now, open MySql databases and add the same database user with the clone database.
- Open File Manager.
- Then, go inside the original Magento site’s directory and copy all its files to the new location’s folder that you’ve created in Step 1.
- After cPanel has finished copying, open the clone’s /app/etc/local.xml file with cPanel’s Code editor tool and replace the database name with the clone database name.
- Go back to phpMyAdmin and select the core_config_data table of the clone database. Replace the unsecure base URL and secure base URL with the subdomain or the subdirectory URL.
- Delete all cache files inside the new location’s /var/cache/ directory.
- Finally, visit the subdomain or subfolder URL on your favorite browser to view your Magento store copy. Also, try logging in to the backend using the same user name and password as the original site.
How to duplicate the database via phpMyAdmin
By carefully following all the above 10 steps, your clone Magento site will be the exact working copy of your existing Magento website.
The fastest way to make it right, if you see an error when visiting the clone Magento site, is to start from Step 1 again. Then, just cleanup later by removing the other folders and databases not in use to free up server disk space.