<!-->Sometimes one needs to move a Magento 2.0 webshop to another server. This is a fairly simple task and the steps are explained below.

Export Magento 2 Database

First, back up the database from PHPMyAdmin, for example.

Backup and transfer of Magento 2 Files and folders

Next, backup the directory where your magento webshop is installed via ftp. Perhaps you can also backup directly from your server and download it as a zip file. Then install/upload the files to the Magento directory of your new server.

Import Magento 2 Database

Meanwhile, using PHPMyAdmin, for example, import the database you previously backed up. To avoid problems always check that the (mysql) database versions are the same

Edit Magento 2 configurations

We have finished exchanging files between the two servers. Now is the time to configure your Magento 2 store with your new server. First, edit the app/etc/env.php by entering the new database data. Open the env.php file using your server file manager and change the lines below:

'Db' =>

array (

'Table_prefix' => ",

'Verbinding' =>

array (

'Default' =>

array (

'Host' => 'DATABASE_HOST',

'Dbname' => 'database_name',

'Username' => 'DATABASE_USERNAME',

'Wachtwoord' => 'DATABASE_PASSWORD',

'Actieve' => '1',

)

)

)

Where:

'host' is the database hostname. The most commonly used host is "localhost."

'dbname' is the name of the database.

'username' is a username.

'password' is the password.

You may have a new domain name for your Magento 2.0 webshop. You need to replace your old server domain name with a new domain name. For this you need to change the value in the database in table
core_config_data
at
web/unsecure/base_url
and
web/secure/base_url

Magento 2 Cache in

The final step is to clear the Magento 2 cache and perhaps wisely redeploy it. You can do this by deleting everything in var/cache located in the magento directory, or you can run the following CLI commands through your terminal:

1: $ php bin/magento cache:flush
2: $ php bin/magento setup:di:compile
3: $ php bin/magento setup:static-content:deploy (en_US nl_NL)

 

That's all you have to do. Your Magento 2 store will now be back online.