Usually when PrestaShop is installed, the server domain, folder etc are stored in PrestaShop database and parameters. Hence it becomes hectic to create replica of existing PrestaShop website because all URL configuration are pointing to old website location in database. So here we will talk about steps to transfer or create replica of existing PrestaShop website on another server or folder in same server.
There are 5 steps required to create replica of existing PrestaShop website:
- Copy PrestaShop folder to target location
- Prepare database backup and install on new database
- Update new URL in database and PrestaShop files
- Update new database details in PrestaShop files
- Clear cache
Step 1 : Copy PrestaShop folder to new location:
You need to copy all files from PrestaShop root folder to 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.
From this step, you will decide physical_uri of your new PrestaShop. The physical URI is the relative path of PrestaShop root folder from server root folder. In 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/“. The physical URI is added to domain to create base URL of PrestaShop website.
Step 2 : Prepare database backup and install on new database
In this step, you will copy the database from old PrestaShop database to your new database. The simplest way to do this is to create database backup from old PrestaShop backoffice. After backup is created, create a new database in new location and import the backup file. This will copy all data from old database to new database.
Prestashop Company ? Read More
Additionally, you will get the database details for new PrestaShop website replica from this step:
- Database host
- Database name
- Login username
Step 3 : Update new URL in database and PrestaShop files
Since you already have domain of your server and physical URI for new PrestaShop location, you need to update these details in database and PrestaShop files.
- To update the URLs in database, you need to update values in two tables: shop_url and configuration.
- Login to new database
- Open shop_url table, you will see one row with old PrestaShop domain and physical URI
- update this table row with new domain in domain and domain_ssl and physical URI in physical_uri field.
- Open configuration table and search for “PS_SHOP_DOMAIN” and “PS_SHOP_DOMAIN_SSL” in name column.
- Update your domain in value for these names in configuration table.
- Lastly, you need to update domain in htaccess file in PrestaShop root directory.
- Open .htaccess file located in new PrestaShop folder.
- You will see old PrestaShop domain everywhere in htaccess file.
- Change the old domain to new domain.
Step 4 : Update new database details in PrestaShop files
The new database details must be updated in the files to make sure the new PrestaShop uses the new database. To update new database details:
- Open /app/config/parameters.php file.
- You will see a list of settings for PrestaShop along with database details like in the screenshot:
- Update database_host, database_port, database_name, database_user and database_password in the respective fields.
After these steps are done, the new PrestaShop is ready to use the new database.
Step 5 : Clear cache
This step is to ensure the old PrestaShop cache does not conflict with new PrestaShop settings. Please delete /var/cache/dev and /var/cache/prod folders from new PrestaShop root folder.
After all above steps are done, the new PrestaShop replica website is ready. This PrestaShop will have everything from old PrestaShop including all data, all modules and all file changes (if any) also.
That’s all about how to create replica of existing PrestaShop website. If any issue or doubt in the above process, please feel free to let us know in the comment section.
I would be happy to help.
For any doubt contact us at [email protected].