Igor's Blog

Recently I've had the task of migrating my dad's online store from the old web host to a new hosting provider. At first this seemed like a scary thing to do, but as I found out it was actually very straight forward and simple. This shows you the steps I took to move the entire PrestaShop installation and store content from one hosting provider to another.

Before I get started, lets define some things...
 Definitions
Host A = old web hosting provider, this is where we're moving from
Host B = new web hosting provider, this is where we're moving to
PrestaShop is running with MySQL.
You can log in as admin into PrestaShop.
You have file system access on Host A and Host B.
You have MySQL admin access on Host B.


The version of PrestaShop in my case was 1.4.6.2, however the same kind of process should be applicable to all versions.

Since this kind of migration requires a name server change at your domain registra, it can take up to 24 hours to take effect. Be prepared for an extended down time for the store in other words!

Step 1 - Put the store into maintenance mode.
This is done on Host A. On the Preferences tab change Enable Shop to No and save the settings. This will ensure that no new transactions come through, no new customer registrations are made, etc...basically it's to lock the shop down for moving.
mig8.png


Step 2 - Take a DB Backup
This is done on Host A. Go to the Tools tab, then to the DB Backup page. Agree to all the questions and generate the backup. This should not take too long.
mig1.png


Download this backup to your computer.
mig2.png




Step 3 - Transfer all the store files from Host A to Host B.
This can be done any number of ways, I chose to take a file system backup on Host A, download it to my computer and extract it's contents. I then compressed all of the files inside the public_html directory into a zip and uploaded that to Host B. This file was then extracted on Host B. I won't go into details of transferring these files over, but basically what needs to happen is to copy all of the PrestaShop files from Host A to Host B.

Step 4 - Get the DB details.
I didn't know any of the database details of the original installation, luckily there is a configuration file that stores all of these. In the PrestaShop directory there should be another directory called config, this in turn contains a file called settings.inc.php. It will have a number of configuration definitions, but the ones we need are listed below, take note of those in your configuration.
 config/settings.inc.php
define('_DB_NAME_', 'Your DB name');
define('_DB_USER_', 'Your DB user');
define('_DB_PASSWD_', 'You DB password');


Step 5 - Create a new DB and user on Host B.
There are different ways of doing this, in my case I chose to use CPanel to create a new MySQL database and user. The idea is to use the details gathered in step 4 to create this new database on the new hosting provider, Host B.
mig3.png


After the database is created a user needs to be created in MySQL.
mig4.png


Once the user is created, add this user to the database that was created and give it all privileges.
mig5.png



Step 6 - Import the DB Backup into the new DB.
The easiest way to do this is to use phpMyAdmin. This is usually installed already by any decent hosting provider. This step is done on Host B. In phpMyAdmin, select the new DB that was created, click the Import tab, select the DB backup file that was downloaded earlier and click Go.
mig6.png


If everything goes well, something like this will be displayed...
mig7.png


The shop is essentially moved over now, but the Internet doesn't know about the new location yet. So onto the next step.

Step 7 - Change the domain name server details to point to Host B.
This is done at the domain registra level. Basically wherever your shop's domain name is registered is where you need to change this information. In my case I transferred the domain from the old host to the new host so my change was done on the new host. I won't go into details on how to do this since there are many ways of doing it and if you're not sure contact the new web hosting provider to show you how.

After the name servers are changed it can take anywhere between an hour to 24 hours for changes to take effect. This is due to how the Internet name servers work and there is no way around this.


Step 8 - Wait for the name servers to update and point to your new host, Host B.
How do you know that everything switched over to the new host? Right now you don't because both Host A and Host B have the same identical shop and database details.

As a handy trick you can edit the index.php file inside the PrestaShop directory on Host B. Simply comment out everything in the file, or even better just make a backup of this file. Then put in something like this into the file at the very top:
 index.php
<?php die("Maintenance mode, shop returning shortly."); ?>


This will force the shop to display the "Maintenance mode, shop returning shortly." message instead of the usual maintenance screen. Once you see that message, you can be sure that the shop has been switched over to Host B.

When you do see this message, either restore the original index.php file or uncomment the parts that were commented out and make sure to remove that line that was added from above.

Step 9 - Clear your browser cache.
This is optional but as a precaution it is a good idea to clear the browser cache so you know that you're getting all the fresh files from Host B when you access the shop and that there are no stale files left over from Host A.

Step 10 - Disable maintenance mode.
Login as admin into PrestaShop and enable the shop. This is similar to Step 1, except you select Yes to enable the shop.

You're done!

Note: I didn't cover moving email addresses over as that's outside the scope of this article, but yes you do need to think about that. The PayPal details usually don't need to change so you can start receiving payments straight away.

Good luck!

-i

, , , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
StrFunc() Online
300 George St Blogumentary
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

NeoOffice Viewer macOS Word Document viewer vs Preview and Microsoft Word

Importance of cleaning the internal fans and heatsinks in a MacBook Pro

Adding an email subscribe feature to your Blog with Blogtrottr

How to remove Google's logo from your G Suite applications

Pedestal fan transformed into a ceiling fan

Testing the Velvet WiFi Hotshot signal strength

Improving slow download speeds on the PS4 and PSN

Add batch image resize functionality to macOS using Automator

Show transfer percentage and speed when copying files in Linux and Bash

So I finally got to try eating some space food

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth

Friends

RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Please follow me on...