In today’s video we will have a look at the Prestashop migration procedure, from a local environment to a live website.
Whether you have your files locally stored, or on another webhosting, you need to upload all of them to the new space.
As I am developing using WAMP (you can use MAMP on mac, or XAMPP), I can simply access my site using and FTP Client, such the free FileZilla, and upload my site to a folder I choose. In my example, I want the site to be reachable at http://nemops-themes.com/testpresta, so all the files will go inside public_html/testpresta.
Of course, if you are moving to the root of the domain, you can simply place all of them inside the public_html (sometimes names httpdocs) folder.
As a side note, if you move from a previous hosting space, you can use a free service like mover.io, instead of downloading and uploading all files again (a great time saver!).
Database Export/Import Operations
First off, we need to export the previous database. Reach your local phpMyadmin and export your database (all tables). Depending on the size, you might want to use a custom export method and compress it (say, with gzip). You might run into timeout errors if it’s too big, at the time you import it!
As soon as it’s done, login to the new hosting control panel, scroll to “Database Wizard”, and create a new database. Then create the user, remembering to store its credentials somewhere safe, and give it all privileges.
Back to the cPanel home, scroll down and click on PhpMyadmin, open the new database, and then import the one we exported a while ago!
Linking to the database
If you try to access your site now, you’ll probably get a ‘Link cannot be established error’. We need to add the new credentials to the Prestashop settings file.
Therefore, access the site via ftp again, then config/settings.inc.php.
You can use any text editor to open it. Find these lines:
And change the database name, user and password according to the new ones!
Re-upload the file.
Final configuration touches
It might look like the site works now, but it’s still redirecting to the old site (the local one, or old domain if you changed it). Using ftp again, delete the .htaccess stored in the root of your Prestashop Installation.
Then, in the database, look for ps_configuration, and search for an entry named ‘PS_SHOP_DOMAIN’. You must change this to the base url of the website. In my case, instead of localhost, I must write nemops-themes.com. Do the same for PS_SHOP_DOMAIN_SSL.
Lastly, access the ps_shop_url table, and change the domain, domain_ssl of the shop(s) according to the new one as we did a while ago. As for the physical_url column, it represents the physical directory where the site is now stored. In my case, I was on localhost/presta156, and now am on nemops-themes/testpresta. So this must be changed to testpresta.
You can now access your website. Just to be sure everything works, navigate to the SEO and URLs tab in the back office, scroll down and save the section with the site urls. This will eventually regenerate your .htaccess file. Please not that you might run into front-end issues if you have Friendly urls enabled, but the new server doesn’t support them!