Usually, when PrestaShop has been installed, the server’s domain, folder, etc., are saved in the PrestaShop database along with the parameters. This makes replicating the existing PrestaShop website difficult, as every URL configuration points to the old site’s location in the database. Therefore, we will discuss the steps needed for transferring or creating a replica of an existing PrestaShop website to another server or folder within that server.
There are five steps to build a replica of the current PrestaShop website:
- Copy the PrestaShop folder to the destination location
- Create backups of your database and then install it on the new database
- Update the URL in the databases and PrestaShop files
- Update database details for the new database in PrestaShop files
- Clear cache
Step 1: Copy the PrestaShop folder into a new location:
You must copy all files in the PrestaShop directory to the new location. For example, If your old PrestaShop files are in /public_html/ folder and the new server folder is /public_html/newprestashop, then you need to copy every file from /public_html and copy to /public_html/newprestashop.
In this stage, you’ll decide the physical_uri of your brand new PrestaShop. Its physical URI is the path relative to the PrestaShop root folder to the server’s root folder. In the above example, if the server root folder is /public_html/ and you are copying PrestaShop in /public_html/newprestashop/, then the physical URI is “/newprestashop/.” A physical URI can be added to the domain to make the base URL of the PrestaShop website.
Step 2: Prepare a backup of your database and install it on the new database
In this stage, you’ll transfer the database from your old PrestaShop database to the new database. The most straightforward way to do the task is to create a database backup using the old PrestaShop back office. Once blockages are constructed, make a brand new database at a new location and then import the backup. The backup file will be copied from the old database to the new database.
Looking for an experienced
Prestashop Company ?
In addition, you will receive information about the database of PrestaShop’s brand-new PrestaShop replica of the website in this step:
- Host of the database
- Name of the database
- Login Username
Step 3: Update the new URL in the database and PrestaShop files
If you already have your server’s domain and physical URI for the new PrestaShop site, you’ll need to change these details in your database along with PrestaShop files.
- To update URLs in the database, you must change the value in the two tables shop_url and the configuration.
- Log in to the new database
- When you open the shop_url table, it will find a row with the old PrestaShop domain as well as the physical URI
- Update this table row by adding new environment, physical URI, and domain_ssl parts in the physical_uri field.
- Open the configuration table, and look up “PS_SHOP_DOMAIN” and “PS_SHOP_DOMAIN_SSL” in the name column.
- Update your domain’s values for these names in the configuration table.
- Finally, you must change the domain name in the htaccess file in PrestaShop, the root directory.
- Access the .htaccess file that is located in the PrestaShop’s new PrestaShop folder.
- You’ll find the old PrestaShop domain everywhere in the htaccess file.
- Switch the old part to the new environment.
Step 4: Update the database information to PrestaShop files
The database must be updated in the file to ensure that the new PrestaShop utilizes the new database. To edit further database details:
- Open /app/config/parameters.php file.
- There is a list of the settings available for PrestaShop and database information as shown in the image:
- Update database_host, database_port databases_name, database_user, and database_password in the relevant fields.
Once these steps are completed, you can use PrestaShop’s new database; PrestaShop is ready to be used with the new database.
Step 5: Clear the cache
This step will ensure that the previous PrestaShop cache does not interfere with the latest settings. Remove the/var/cache/dev and the /var/cache folders from the new PrestaShop directory.
Once all the above steps are completed follo, wing these steps, and the latest PrestaShop replica will be ready. This PrestaShop will contain everything from the previous PrestaShop, including all the data, modules, and any changes to files (if there are any).
This article will explain how to create a replica of the existing PrestaShop website. If you have any doubts or issues about the process described above, please share your thoughts in the comments section.
I’m glad to assist.