- This is a complete guide for PrestaShop 1.6, you can find a brief one here How to move a PrestaShop site 1.6 site
- We also have a guide for PrestaShop 1.7, check it out here how to move a PrestaShop 1.7 site
If you already started your PrestaShop store on localhost and now you want to migrate to live server, this article is for you. In this tutorial, we are going to move the PrestaShop store from local server to a new web server. With this guide, you can move your site from one server to another one.
To move the PrestaShop store from one server to another one, we have to follow 9 steps.
1. Backup Database
- Go to phpMyAdmin.
- Select your database.
- Click on "Export" from the top menu.
- Select " Custom – display all possible options" in the "Export Method" section.
- Click on "Select All" in "Tables" section to select all tables.
- Choose "Zip" for "Compression" option in the Output section.
- Scroll down and click on "Go" at the end of the page.
- Download backup on your hard drive.
2. Change website URL from localhost to your domain
- There is a .sql file in the downloaded .zip file, open the .sql filewith a text edit(Like Editplus, Sublime), replace all old urls with new urls. For example, the domain on your local is localhost:8080, then you just need to replace all localhost:8080 with www.yourdomain.com.
- Zip the modified .sql file.
3. Change Database information in settings.inc.php file
- Go to the folder that you have installed your localhost server. We used WampServer so it's in "C\wampserver\www". Open the directory that you have installed PrestaShop on it.
- Go to the "config" folder.
- Edit the "settings.inc.php" file.
- We have to change these four lines as our new database information.
define('_DB_SERVER_', 'localhost'); define('_DB_NAME_', 'YOUR_DBNAME'); define('_DB_USER_', 'YOUR_DBUSERNAME'); define('_DB_PASSWD_', 'YOUR_DBUSERPASSWORD');
Generally, there is no need to change the _DB_SERVER_, keep it as localhost or 127.0.0.1
- Click on Save.
4. Zip files
Select all site files and Zip them using your archive software.
5. Move zipped files to your online server
Use FTP client like Filezilla, WinSCP (or any other software that allow you to move files through FTP) to move your zipped files to public_html.
6. Create a database in your online server
- In cPanel, click on "MySQL Databases" in "Databases" section.
- Fill in "Create a New Database" field with a custom name of the database. It can be the same as your database in localhost or you can change it.
- Click on "create database".
- Now we have to add a user for this database. (Generally, we don't do this in localhost and we just use root user, but in the online server, we have to do it). Scroll down to "MySQL Users" section and enter a username in "Add a New User" section.
- Now we have to choose a password for this user. The best and most secure way is using "Password Generator" button to generate a random and strong password. After generating the password, copy it to a secure place and check the "I have copied the password to a secure location" and finally click on "Use Password".
- Click on Create User.
- Now we have to add this user to our database and give it full access. To do this, in "Add a User to a Database" section, first select user, then select Database and finally click on Add.
- New "MySQL Account Maintenance" page will show up and we can choose this user permission. We have to check "ALL PRIVILEGES" option and click on "Make Changes".
7. Import database to your online server
- In cPanel, Click on "phpMyAdmin" in "Databases" section. If it asked you for username and password, enter the username that you have created in the previous step.
- Click on the database that you have created.
- Click on "Import" from the top menu.
- In the "File to Import" section, click on Browse (Mozilla) or Choose (Chrome) button.
- Select Zipped backup that you have exported in first step.
- Scroll down and click on "Go".
- Wait until you got succeed message for importing database.
8. Extract files in online server
- In cPanel, click on "File Manager" in "Files" section.
- Navigate to the public_html folder and right click on the zip archive that you have uploaded it using FTP and click on Extract.
- Now we can choose where to extract files.
If you want your site to be on the main domain, you have to extract it in public_html. - If you want your site to be on Sub Domain / Sub Directory, you have to enter that folder name here.
- Notice that if you want to use Sub Domain / Sub Directory, you have to create it before.
- Click on "Extract Files".
9. Delete .htaccess file
- Go to the folder that you extract to it (or public_html).
- Download the .htaccess file as a backup.
- Now delete it.
That's it. Go to your domain and check it. With this guide, you can move the PrestaShop store from local to a new server or migrate from one online server to another one. If you have any question please ask it in comments. We will respond very soon.