In this tutorial, we will show you the process of data migration from Magento 1 to 2 in a handful of steps. This aims to avoid using the end-of-life Magento 1 and the new, more reliable Magento 2 software. The risks of using the EOL Magento 1 are the following: security loopholes, outdated features, PCI compliance, and limited support. Migrating to Magento 2 has many benefits, such as enhanced security, improved performance, advanced features, and extensive community support. Migrating Magento 1 to Magento 2 is a complex process requiring a detailed plan and essential steps to ensure a successful migration.
Table of Contents
Step 1. Planning the Migration
Before we can start the migration, we have to plan it first. The migration includes moving everything from Magento 1 to Magento 2, including the database, extensions, themes, and sometimes the custom code. We have to make a couple of checks before we start the process.
Analyze the Magento 1 Store: This is necessary to decide what should be kept. If you have outdated extensions or data incompatible with the new Magento 2, you should find replacements. This also applies to the Theme. You need to find a replacement for your current Theme.
Remove unwanted pages, logs, outdated data, and unnecessary and unused extensions.
Custom code should also be checked. Copy the custom code somewhere so you won’t lose it during the migration.
Check Theme: Check if the theme is compatible with Magento 2. If not, you must buy a new theme for the migration.
SEO analysis: The migration will affect ranking since the content of the new pages will change. Glancing at your site’s SEO before the Magento 2 migration is also essential. You can use Google Analytics to check your store’s ranking components.
Backup: The last and most crucial step in planning the migration is making a backup of your Magento 1. This includes a backup of the application files, the database dump, and, even better, a backup of the whole VPS if the hosting company offers one. This is necessary to revert the changes if something goes wrong during the migration.
Step 2. Staging Environment
Having another staging environment is definitively a must. You need the exact copy of your current Magento 1 store on the same server. This is necessary because the migration will be done in the staging environment, not the production, so there will be no downtime. All you need to change in the staging environment is the domain name in the web server configuration files, such as staging. Your domain.com and change the name of the database. So, in other words, you will have two Magento 1 instances: the original one, the production, and the staging where the migration to Magento 2 will be tested.
If your hosting provider provides a snapshot of your VPS, you should have it up and running immediately. Otherwise, you will need another server while you are migrating Magento.
While writing this blog post, we used the same server and worked in the staging environment, which had its own document root, staging database, and different subdomains to test the migration.
Step 3. Install Magento 2
After creating the staging environment, the next step is installing Magento 2. Before you install the Magento 2 store, you need to check its requirements, such as the PHP and MySQL versions, Redis cache, etc. Magento 2 can be installed multiple ways, from the archive file to the composer and Github. If you do not know how to install it, follow our tutorials about Magento 2.
Step 4. Magento 2 Migration Process
We can start explaining the migration process when we have a Magento 1 staging website and a fresh Magento 2. You can not simply migrate everything simultaneously and expect to work without issues. We have to move on step-by-step. In the following paragraphs, we will show you what to do and what you need to migrate first.
1. Stop any Magento 1 cron jobs. If cron jobs need to run, make sure they do not create entities in the database.
2. Theme migration is the second step. You can not migrate the theme directly, so you need to buy a new theme compatible with Magento 2.
3. Next, migrate the extensions. Check which extensions from Magento 1 are compatible with the Magento 2 version. Ensure that you migrate the necessary plugins.
4. The next thing you can do using the Code Migration Toolkit is migrate the custom code. If necessary, you may need to develop new code for Magento 2. For this, it is best to contact your PHP developer.
5. Data migration is the last step of the migration process. Magento has officially released the Magento 2 Data Migration Tool, which will be explained in the next paragraph.
Step 5. Install the Data Migration tool
Data migration can be installed via Composer. For this step, it is essential to install the exact version of the Data migration tool as the Magento 2 version. For example, if you are using Magento 2.4.3, the version of the Data Migration Tool must be 2.4.3 as well. The command for installing the Data Migration tool is very simple, but first, you need to update the location of the tool’s package in the composer.json file.
composer config repositories.magento composer https://repo.magento.com
Then, the command for the Data Migration tool:
composer require magento/data-migration-tool:2.4.3
After this command, you must add the authentication keys stored in the Magento store in the Access Keys under the “My Products” section. If you already have keys, the public key is the username, and the private key is the password.
Step 6. Configure Data Migration Tool
In this step, it is essential to know if you are migrating the Magento 1 Open Source to Magento 2 Open Source, Magento 1 Open Source to Magento 2 Commerce, OR Magento 1 Commerce to Magento 2 Commerce. This is important for you to know which config.xml file should be edited. Let’s assume that the document roots of both Magento installations are the following ones:
Magento 1: /var/www/magento1 Magento 2: /var/www/magento2
If you want to migrate from Magento 1 Open Source to Magento 2 Open Source, then you need to open the following file:
/var/www/magento2/vendor/magento/data-migration-tool/etc/opensource-to-opensource/Magento 1.xconfig.xml.dist
Edit the file to look like this:
<source>
<database host="localhost" name="Magento1-database" user="Magento1-database-username" password="Magento1-database-password"/>
</source>
<destination>
<database host="localhost" name="Magento2-database" user="Magento2-database-username" password="Magento2-database-password"/>
</destination>
<options>
<crypt_key>Magento1-Encrypion-Key</crypt_key>
</options>
Save the file, close it, and then rename this file so you can start the migration:
mv config.xml.dist config.xml
To start the migration process, you can use the following command:
cd /var/www/magento2 php bin/magento migrate:settings --reset vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.x/config.xml php bin/magento migrate:data --reset --auto vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.x/config.xml
These commands will migrate the settings first, followed by the data. After this process is finished, we have to move some data manually, which will be explained in the next paragraph.
Step 7. Media Files Migration
In this step, we need to migrate the media files manually since this is not done automatically in the previous steps. To do that, execute the following command:
rsync -Waq /var/www/magento1/media /var/www/magento2/pub/media
If your Magento 1 stores the media files in the database, they will be migrated with the previous step, yet they need to be synced before migrating the data.
Step 8. Recompile the Magento 2
Once you finish the previous commands, the next step is to upgrade, recompile, clear the cache, and reindex the Magento 2:
cd /var/www/magento2 php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento steup:static-content:deploy -f php bin/magento cache:clean php bin/magento cache:flush php bin/magento indexer:reindex php bin/magento deploy:mode:set production
The products should appear in the new Magento 2 dashboard if everything is OK.
Conclusion
This was the superficial plan for data migration from Magento 1 to 2. This may not work on the first try since migrating Magento 1 to Magento 2 is a complex process. According to statistics, the average time for this migration is 1000 (around 5 months) hours. This migration includes the planning stage, customer journey maps, UX and UI design, frontend and backend work, data migration, post-release work like testing, etc.
We can handle everything server-related. You only need to sign up for one of our Magento VPS plans and provide us with your Magento 1 server credentials. As explained above, we can help with Magento 2 installation and data migration. Everything will be set up to the stage where you will require developer assistance. We are available 24/7 and will take care of your request immediately.
If you liked this post about data migration from Magento 1 to 2, please share it with your friends or leave a comment below.