Migrating your PrestaShop store to a new server is one of the technical tasks any online store owner is confronted with at some point in time. It isn't particularly difficult to move your entire e-commerce to a different server. That said, there are a number of factors to take into account and a procedure to follow in a set order to avoid problems with your website. We've created a mini-guide on the PrestaShop blog that will help you to migrate your site to another hosting service.
Before you start...
Before migrating your PrestaShop website, make sure you meet all of the following conditions:
- An FTP client (of your choice) must be installed on your computer and you must be able to connect to your new and old servers using FTP. If you have any problems at this stage, contact the support department of your hosting service to get all the information you need.
- You must have an administrator account in your online store cPanel on both your new and old servers.
- You must also have a back office administrator account for each of your online stores.
Ready? Let's start the migration!
Step 1: Check the PrestaShop version your store is running on, then put your site in maintenance mode
If necessary, update your website's version of PrestaShop. To find out which version of PrestaShop your store is running on, consult your toolbar. If you're running version 1.6, it's at the top of your store's back office page. If you are running version 1.5, you'll find the toolbar at the bottom of the screen.
Even though it's not required, we recommend you put your online store in maintenance mode. That way, if someone tries to access the domain, you won't lose any data while migrating your PrestaShop site. If your website is in local mode, this step is unnecessary, since your PrestaShop website is not public.
Step 2: Make a backup on your old server
To do this, you'll need to open the control panel of your current server (the old one) with administrator rights and search for the backup module that will allow you to quickly generate a backup of your entire PrestaShop website. If you have any problems at this stage, contact the support department of your hosting service. They will explain the steps you need to take.
As soon as you've finished your backup, download it to your computer. Don't complete any of the migration steps for your PrestaShop site until you've backed up your store. That way, you won't lose your website if anything goes wrong.
Step 3: Download your online store's files to your computer
Now it's time to start the migration. Download your online store's files to your computer by following these steps:
First, create a new folder on your desktop and open your FTP client of choice. Then connect to your current (old) server using FTP. Once you've successfully completed this step and the connection is active, a list of folders will appear in the right-hand panel.
Once connected, you will need to navigate to your public directory, usually called public_html or htdocs, and open it. Note that if your online store is located in a subdirectory — in other words, installed within a domain such as www.tuweb.com/tienda — you must locate the corresponding folder and open it.
Select all the files (Ctrl + A/Cmd + A) and drag them into the folder that you created on your desktop to download them to your computer. This process can take a few minutes, depending on the number of files and their size.
Once you have finished downloading all the files from your PrestaShop site, an alert will appear to let you know that the file transfer is complete.
Step 4: Export your store's database
Once the files have been transferred to your computer, return to your current (old) server's cPanel and find the module phpMyAdmin, a tool written in PHP to manage databases. You can use it to create, delete, or modify data in SQL databases.
With the module open, you will see a list of all the available databases on the left-hand side of the screen. Choose the database of your current (old) online store. On the right-hand side, you'll see a list of tables.
Click on "export" to start downloading the database. Leave the default options activated and continue. Your browser will begin downloading an archive with a copy of your PrestaShop online store data.
Step 5: Create a new database on the new server
Open your new server's control panel using an administrator account and find the module MySQLDatabaseWizard, then follow the steps to create a new database. Give it a name that's completely different from the database on your previous PrestaShop website.
Step 6: Import the old store's database to the new server
Find the phpMyAdmin module on the server. Once you've opened it, you will see the database you just created in the list of available databases in the left-hand panel. Select it.
In the right-hand panel, click on "Import", then select the file you uploaded in step 4. Once you've successfully imported your PrestaShop website database, an alert message will be displayed.
Step 7: Upload your store's files to your new server
Go back to your FTP client and log in to your new server. Navigate to your public_html directory. If you wish to save your online store to the root directory or to a subfolder (in other words, www.tuweb.com/tienda), first create the folder inside the public directory, then open it.
Drag your files (which you copied during step 3) from your desktop and drop them in the corresponding directory on the new server. This process should take a few minutes.
Step 8: Edit the PrestaShop config/settings.inc.php files
Use your FTP client to search for the file 'config/settings.inc.php', open it and edit the lines that follow.
You must edit the PHP file using the information provided by your hosting service and the information you chose when you configured your PrestaShop site.
- DB_SERVER: Your database's server;
- DB_NAME: Name of the database from step 5;
- DB_USER: User associated with the database;
- DB_PASSWD: The user's password;
Save the folder and upload it to the server.
Step 9: Verify authorizations
Before checking to see if your new online store is working correctly, you must ensure that authorizations are configured correctly for your files and directories. Always check first with your hosting service, but generally, most work with:
- File authorizations: 664
- Directory authorizations: 755
If you have any problems uploading images, try authorization 777.
Step 10: Clear the cache
Ideally, clear your page's cache and re-index to make sure that everything is working properly. Note that if you do not follow this step, the data that you see may be from the previous version of the page saved in your browser's cache, so you may not be able to detect potential errors.
To completely clear the cache, delete all the content in the folders '/cache/smarty/compile' and '/cache/smarty/cache', except for the file index.php (in both cases).
Step 11: Deactivate maintenance mode
Return to your PrestaShop site's back office and deactivate the maintenance mode you activated for your online store.
Finally, log in to your domain and make sure that your site is working correctly. If it loads correctly, migration of PrestaShop website to another hosting service was successful. Your online store is open for business on your new server.