fb-pixel
Logo Supporthost

How to migrate PrestaShop: step by step guide

May 12, 2023 / Published in:  from Maria Grazia Guzzo
5 Comments

 In this guide, I will show you how to migrate PrestaShop step by step.

If you are moving the site to another server or transferring it from local to remote, you will find all the correct procedures you need to follow to avoid errors.

Don't want to take care of the transfer yourself? If you choose one of our servers for PrestaShop, you will be able to request a free migration.

Simply order the plan and then open a ticket to request the migration. After that, you can arrange and organize with our support team the most suitable time to start the transfer without any disruptions to the site.

If you want to proceed independently, I will explain two cases:

  • how to move a PrestaShop site while keeping the same domain;
  • how to migrate and change the domain of the site.

Initially, the procedure is identical for both situations.

Let's start with the first step.

How To Migrate Prestashop

Preparing for PrestaShop migration

Before you start migrating your PrestaShop store, you need to check a few things.

In its official documentation, PrestaShop recommends migrating from one server to another only after upgrading the store to the latest version.

If you don't know how to proceed, you can follow our PrestaShop update step-by-step guide.

In this guide, you will see the steps for version 1.7.X, we used version 1.7.8.7 to be specific.

Prestashop Official Logo Flat

Putting your shop into maintenance mode

When you change hosting, before you transfer your site, it is advisable to activate maintenance mode.

This is an important step especially in the case of an e-commerce. By putting your store under maintenance, you don't risk losing customer orders during the migration process.

We recommend that you plan your migration in advance and choose a day and time when you expect there will be fewer orders.

To activate maintenance mode, do this:

  1. click on Shop Settings > General;
  2. click on the Maintenance tab;
  3. set the "Enable shop" option to "No";
  4. click on “Save”.
Prestashop Enable Maintenance Mode

As an optional step, you can enter your IP address to continue monitoring the shop even if it is in maintenance mode. You can also customize the text users will see until your shop is available again.

Backing up your files

The time has come for the most important step of the PrestaShop site migration. Create a backup.

The first thing we need to do is download a backup of all the files on our PrestaShop site.

There are several methods to do this, for example:

  • you can use an FTP client to download the files to your pc;
  • you can create a zip file with all site files directly from the cPanel file manager.

For the purposes of this guide, let's see how to do it by connecting to the server with an FTP client like FileZilla.

Keep in mind that to do this you will need the following data:

  • hostname;
  • FTP account username;
  • password;
  • FTP port.

If your provider uses cPanel you can find this data in the FTP Accounts section. If you haven't created an FTP account yet, you'll need to do so before proceeding.

After connecting to the server with FileZilla, we just need to find the folder that contains the site's files and download all its contents to our computer. Make sure you select all.

Filezilla Backup Prestashop Files

Remember that if you have installed PrestaShop in the root of the domain, the folder containing the files will be "public_html". If you used a subdomain or subfolder instead, you'll need to locate the correct folder.

In this way, we download a backup of the files from the source server to our computer. Now it's time to move on to the database.

Pro Tip: With the SSH access you get with all our plans, including unManaged VPS cloud hosting, you can move files using LFTP (an FTP client you can use from a terminal). In this way, you connect to both servers and move files faster. You must have SSH access on both the source and destination servers.

Exporting the database

We have to create a copy of the database from the current server and then import it later on the new server where we are migrating the PrestaShop store.

The procedure depends on the system used by the provider to manage the database. In most cases you will be able to do this with phpMyAdmin.

This tool allows us to make changes to the database, but also to export and import entire databases.

Important Note: If you see more than one database when you access phpMyAdmin, you need to make sure you export the correct one.

To find the name of the database, consult the "parameters.php" file found in app/config/. You will find this information on the "database_name" line.

From phpMyAdmin, select the database and click on the “Export” tab. Then you just export the database with the default export options, using the SQL format.

Export Database And Migrate Prestashop

How to migrate PrestaShop to another server

To recap: we created a copy of our PrestaShop site files and exported the entire database.

Now we need to copy files and databases to the new server and then edit the configuration files needed to make everything work properly.

Importing the database to the new server

To migrate PrestaShop to another server, we need to import the database.

First, we need to create a new database on the new server.

On cPanel, the procedure is very simple. If you don't know how to do it, you can use the "MySQL database wizard" option, which will guide you step-by-step in creating the database and user.

Migrate Prestashop Mysql Database Wizard

After creating the database, open phpMyAdmin, click the list on the left, on the name of the database we created. As you can see, the database is still empty. Now click on the "Import" tab.

Phpmyadmin Import Prestashop Database

From here, we have to click on “Choose file” and then select from our computer the .sql file containing the database we downloaded in the previous step. The file will be named "database_name.sql" or "database_name.sql.zip".

Migrate Prestashop Import Database

After selecting it, scroll to the bottom of the page to click on the “Import” button. 

A warning will confirm that the PrestaShop database has been imported.

Migrate Prestashop Import Database Step 2

Editing configuration files

Now that we have imported the PrestaShop database to the new server, we need to get the shop associated with the correct database.

Let's open the folder where we downloaded the backup of the PrestaShop files.

The file we need to edit is here: app/config/parameters.php

We can edit it with an editor such as Windows "notepad".

In the file, we must insert the information regarding the new database. Let’s see which rows we need to modify.

Migrate Prestashop Edit Parameters File
'database_host' => 'localhost',

Refer to your hosting provider's directions, if you are migrating to SupportHost you will need to use "localhost" as the database host.

'database_name' => 'DATABASE-NAME',

Replace "DATABASE-NAME" with the name of the database you created on the new server.

'database_user' => 'NOME-NUOVO-UTENTE',

As in the previous line, enter the username associated with the database you created.

'database_password' => 'NEW-PASSWORD',

Enter the password of the user associated with the database.

After entering all the correct data, you can save the file.

Upload the files to the destination server

After following all the above steps, you will be able to upload all files and folders to the new server.

You can use the same method we've seen before: connect to the new server via FTP using a client like FileZilla.

This time, you will have to do the reverse process: select all site files and folders from your computer and upload them to the server.

So select the files from the "Local site" section of FileZilla, open the destination folder in the "Remote site" section (for example, public_html to upload them to the root), and then upload them (right-click> Upload).

Filezilla Upload Prestashop Files

Note: if you want your shop to be reachable from an address such as "www.yourdomain.com/shop" just create the "shop" folder in public_html and upload your files to it.

If you want to use a subdomain, just open public_html and then select the folder corresponding to the subdomain you want to use, for example "shop.yourdomain.com".

Final steps to complete the transfer

Now that we've completed the migration, there are two possible cases.

Situation 1: You have decided to migrate your PrestaShop site and use the same domain on the new server.

In this case, you will need to change the domain pointer.

Situation 2: You want to migrate the server and change the domain.

You will need to edit the store configuration settings to change the domain to the new one.

Let's see how to do both.

Complete PrestaShop migration (without domain change)

In this case, we have to change the domain pointer to ensure that when we visit the “domain.com”, the site is connected to the new server and no longer to the old one.

Before doing so, however, I suggest you verify that the migration was successful and that your e-commerce is working properly.

How do we visit the site if the domain still points to the old server?

We just use the hosts file.

The hosts file in our computer allows us to map the IP address to the domain. All we have to do is add a line with our domain and the IP address of the new server.

Edit Windows Hosts File

After completing this procedure, when we connect to the site through our web browser, we are directed to the one on the new server. We can then check that the site is working properly.

After that, we can proceed to change the domain pointer and wait for the changes to be applied (it usually takes a few hours).

How to migrate PrestaShop and change domain

If, in addition to transferring the PrestaShop site from one server to another, we would also like to change the domain, we need to change the site settings.

We can make this change from the database.

Firstly, we open phpMyAdmin to access the database on the new server.

Modify the ps_configuration table

We search the database for the “ps_configuration” table.

Note that the prefix of the table name might be different. In the example shown, the prefix is “ps45”.

Migrate Prestashop Edit Ps Configuration Table

In the table, we need to look for:

PS_SHOP_DOMAIN
PS_SHOP_DOMAIN_SSL

In correspondence with these lines, in the value section, we will see the address of the old domain. We need to edit that section by inserting the new domain, which you need to enter as “domain.com” without including “https:/”.

Prestashop Edit Shop Domain From Database

Modifying the ps_shop_url table

Keep in mind that even in this case, the prefix may not be "ps" but something else (just like in the example).

Edit Shop Url From Prestashop Database

Let's open it to edit it.

Inside, we will see three values:

  • domain;
  • domain_ssl;
  • physical_uri.

If we have uploaded the site files inside the root of the new domain, we have to change the values as follows:

  • enter the new domain in the domain and domain _ssl sections;
  • enter “/" in the physical_uri section.

Here’s an example where the new domain is “domain.com”.

Prestashop Edit Shop Url From Database

If you have uploaded the files in a subfolder, do this:

  • enter the new domain in the domain and domains_ssl sections;
  • enter the folder name in the physical_uri section (e.g.,“/store”).

For example, if your site is located at domain.com/shop, you'll need to change the values ​​as shown here:

Prestashop Change Shop Url From Database

Disabling maintenance mode

After we have verified that everything is working properly, we can bring our site back online by disabling maintenance mode.

From the back office, we can click on “Maintenance Mode“, as shown here:

Prestashop Disable Maintenance Mode

Then set the Enable shop option to "Yes" and click "Save".

If your site isn't working properly, follow the methods in the next section to resolve common errors after site transfer.

Solving common problems after PrestaShop migration

Here are the solutions to solve some of the most common problems that occur after transferring PrestaShop from one server to another.

It is not possible to access the back office

In some cases, after migration of the site, trying to access it results in a 500 error message or a blank page.

If you are unable to access the PrestaShop admin area after transferring your site, there are a few things to check.

  1. First, make sure you have edited the parameters.php file and entered the correct data for the new database.
  2. If the data is correct and you continue to see the error, try renaming the .htaccess file, for example, “.htaccess-deactivated”.
  3. If you still can't log in this way, you can activate PrestaShop's debug mode.

How to enable PrestaShop debug mode

Open the "config" folder and edit the "defines.inc.php".

Find the following line:

define('_PS_MODE_DEV_', false);
Prestashop Enable Debug Mode

And change it to this:

define('_PS_MODE_DEV_', true);

Try to access the PrestaShop back office again to see if it works.

Having activated the debug mode, if there are errors, you will see them displayed on the screen.

Remember that after finding the error you will need to turn off debug mode again.

The site only works in debug mode

If you are unable to view the site correctly when PrestShop’s debug mode is disabled, you could try deleting the cache.

In this situation, you can clear the site cache manually.

To do this, open the folder “var/cache”. Inside, you will find the folders "prod" and “dev". Delete them (or simply rename them) to see if it solves the problem.

Pages or images are not visible

After migrating the PrestaShop site, some pages or some images might not appear correctly.

Image Bug After Migrate Prestashop
Here is an example of an image that does not load correctly after migrating a PrestaShop site.

If when visiting some of the pages on your site you see an error such as "Page Not Found" or "Not Found The Requested URL", here is what you can do.

Log in to PrestaShop back office and go to Shop Settings > Traffic & SEO. From here, scroll down until you find the 'Set URL' section, then change the Friendly url option to 'No' and save.

Repeat the operation and re-enable the Friendly url setting (set it to "Yes" and save). By doing this, PrestaShop will regenerate the .htaccess file and you should solve the problems you are having.

The pages are visible but have errors

If the pages of your PrestaShop store are reachable after the migration but don't load correctly, you can try clearing the cache.

To do this, simply access your store's Back Office and go to Advanced parameters > Performance. From there, you can click on the “Clear cache” button as shown here:

Migrate Prestashop Clear Cache

Conclusion

We have looked at how to migrate PrestaShop from one server to another in detail. You can also follow this same guide to transfer a locally developed PrestaShop site to a server.

Remember that after transferring your files and database, you still have one last step to do:

  • if the domain has remained the same, you need to change the domain pointer.
  • if you have changed the domain, you need to modify the database to associate it with the new domain.

At the end of this guide, I have listed some of the most common errors that can occur after a transfer.

Were you able to migrate your site successfully or did you experience some difficulties? Let us know in the comments.

author image

Maria Grazia Guzzo

She combines her passion for writing and technology to create in-depth, easy-to-understand guides. She believes in zero fluff content, written by and for people.

Related posts

5 comments on “How to migrate PrestaShop: step by step guide”

  1. Internal server error 500. Some database tables, several dozen, point to specific domains, which, even if renamed one by one, do not allow the database to connect. Then there are the security tokens, generated at the time of installation. All migration tutorials are the same, meaning, just the same, copied from each other. In none of these there is the final result or the video explanation of the working procedure, why... it doesn't work. Getting those who have a prestashop site worth a few dozen gigabytes into trouble for making a page copied and recopied on multiple sites, in different languages, is unethical. Then, what does the host file have to do with it, I don't understand, if you don't first spend the night configuring the server and its SSL certificate.

    1. I guess they are all similar because that is the correct process. We did a migration and documented all the steps.
      If you have problems, most likely you are doing somthing wrong, or one fo the steps are incomplete (for example some of your files haven't been moved).
      We plan to create a video for every article on our website, we plan to start publishing those in a few months from now.

      1. Ci sono i tokens di sicurezza, parlo in italiano che ci capiamo meglio. E' vero, quella è la procedura spiegata in qualsiasi sito. Ma non funziona. "Dump dei dati per la tabella `ps_log`", riga 10500 circa. Quello è il problema dell'errore 500. Sia che svuoti la cache, sia che li rinomini uno ad uno.

  2. Absolutely fantastic article! It addressed all the migration issues I encountered along the way with PrestaShop. The solutions provided were incredibly helpful and resolved every single problem I faced. Highly recommend it to anyone navigating PrestaShop migrations!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.