Migrate Magento from one server to another server

magento server migration

In this article we will guide you how to move magento from one server to another server, this migration process includes many steps which you need to take care of it  without any mistakes. We have outline the simpler steps to make this task successful without any interruptions.

Step 1: First thing you need to check whether backups are taken properly or not, if you found no proper backups available then you need to take the complete backups of magento folder along with the database. Use the below command to take the backups

For example,

zip -r magentobackup.zip /home/backupfolder/

mysqldump -u username -p database_name > /home/backupfolder/database_name.sql

Step 2: Once backup is taken, you need to make a list of requirements that is present in the current server where magento is running successfully. Requirements like RAM details,Disk space details,php version,mysql version,php extensions is very important that should be remain same in the new server where you are going to migrate.

Step 3: Login to your new server and create appropriate user account where you need to transfer the backup data. Also create a new database along with username and password, make it ready with all other requirements things along with dns configurations before the transfer takes place.

Step 4: Once everything is ready now you can migrate the complete backup data’s to the new server to its appropriate path. Use the below command for faster file transfer with SSH:

For example,

rsync -avzhe ssh --progress /home/backupfolder/magentobackup.zip This email address is being protected from spambots. You need JavaScript enabled to view it.:/var/sentora/hostdata/username/public_html/

rsync -avzhe ssh --progress /home/backupfolder/database_name.sql  This email address is being protected from spambots. You need JavaScript enabled to view it.:/var/sentora/hostdata/username/public_html/

Note: IP address mentioned here is the new server IP.

It will ask for the password to be enter, you need to enter the root password of the new server where you are going to transfer the data.Once you entered the password data transmission will start and wait until it gets completed.

Step 5: Once data transmission gets completed extract the file backup to your new magento directory and give the appropriate file/folder permissions along with proper ownerships. Use the below command to change the file/folder permissions:

chmod -r 755 public_html/

chown -r apache:apache public_html/

Note:Usually 644 for files and 755 for folders.

Step 6: Import the database to your new server make sure that database is created with username and password.

You can use command or mysql module present in the server to import the database:

mysql -u [username] -p [database_name] < [dumpfilename.sql]

Step 7: Now you need to adjust the magento configuration,this includes editing the config file with proper database connection details i.e To adjust the config file, edit the contents of path/to/magento/app/etc/local.xml so that the database connection information matches with your newly created parameters:


Next step is to, open up phpMyAdmin or any another MySql management tool and connect to your newly created database. Once its get connected open the table named “core_config_data” and edit the proper values for “web/unsecure/base_url” and “web/secure/base_url” to match your new register domain name. For your reference we have given the screenshot of the appropriate table below.


Step 8: Now you need to empty the Magento Cache/Sessions that may be present from old installation and reindex the data. You can do this either by login to magento admin panel > System > Cache management or by deleting the contents available under var/cache and var/session folders inside your Magento installation directory.

Use the below command to remove the cache:

rm -rf path/to/magento/var/cache/*

Use the below command to remove the session:

 rm -rf path/to/magento/var/session/*

Modify the URL rewrites if required as per your requirement.

Step 9: If you have installed any SSL certificates to your domain name were magento was running previously  then you need to contact your hosting provider for the same. Also recreate the robot.txt, sitemap and any other files related to SEO aspects.

Now you are able to load up  your new Magento installation on the new your server without having to start from the scratch. If you face any issue after completing all these steps then you need to check with the error logs present in the server and you can contact your hosting provider for the further help.