Moving magento site from one server to another server

Moving magento site from one server to another server

September 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Moving magento site from one server to another server

Migrating Your Magento Site Between Servers: A Comprehensive Guide

TL;DR: Moving a Magento site from one server to another requires careful planning and attention to detail. In this guide, we’ll walk you through the process step by step, ensuring your data and customizations remain intact.

Understanding the Migration Process

Migrating a Magento site involves two primary components:

  1. File Transfer: All the static and dynamic files on your current server.
  2. Database Migration: The MySQL database containing your products, orders, customer data, etc.

Step 1: Prepare Your Environment

Before you begin, make sure the new server meets the official Magento system requirements. Ensure it has PHP 7.2 or later, and a compatible MySQL version (5.6+).

Step 2: Backup Everything

Backup Your Files

Use SFTP to download all the files from your current Magento installation. You can use tools like FileZilla or Cyberduck for this purpose.

# Using SFTP with FileZilla
sftp://username@old-server.com/magento

Backup Your Database

Use a MySQL dump tool to create a backup of your database.

mysqldump -u [database_username] -p[database_password] [database_name] > /path/to/backup.sql

Replace [database_username], [database_password], and [database_name] with your actual details. Run this command on the old server’s terminal.

Step 3: Set Up Your New Server

Create a New Database

Log into your new server’s control panel (like cPanel or Plesk) and create a new MySQL database. Note down the database name, username, and password.

Upload Files to the New Server

Using SFTP again, upload all the files you downloaded earlier to the web root of your new domain on the new server.

# Using SFTP with FileZilla
sftp://username@new-server.com/public_html/magento

Ensure that the index.php file is in the correct location and is executable (permissions should be 644).

Step 4: Restore Your Database

Import the SQL Backup

Use MySQL to import the backup you created earlier.

mysql -u [new_database_username] -p[new_database_password] [new_database_name] < /path/to/backup.sql

Replace [new_database_username], [new_database_password], and [new_database_name] with the details of your new database.

Update the Database Configuration

Open app/etc/local.xml on the new server and update the following lines:

<db_host>localhost</db_host>
<db_name>[new_database_name]</db_name>
<db_user>[new_database_username]</db_user>
<db_password>[new_database_password]</db_password>

Step 5: Final Touches

Update the Base URL

Log into your Magento Admin panel and go to System > Configuration > General > Web. Set the Base URL to match your new domain.

Clear Cache

Go to System > Cache Management and click on Flush Magent Caches.

Potential Issues and Solutions

404 Errors After Migration

If you’re seeing a 404 Not Found error after the migration, it’s likely due to incorrect file permissions or ownership. Use the following commands:

chmod -R 755 /path/to/magento
chown -R apache:apache /path/to/magento

Missing Images/Files

Ensure that your new server has access to the same media storage location as your old one. You can either use the local file system or configure Magento to use a remote FTP/SFTP server for storing media files.

Conclusion

Migrating a Magento site isn’t complicated, but it requires careful attention to detail and understanding of the process. Always ensure you have backups before starting any migration work.

Remember that if your current version is very old (like 1.4), consider performing an in-place upgrade on the new server rather than a simple file and database copy.

If you require assistance with a larger or more complex migration, feel free to reach out to our team at Laravel Company. We specialize in Magento migrations and upgrades.

Catalog Database Orders Customers

Our network