How to move Magento from one server to another?

Web Design & Development

If you are a Magento developer sometimes you need to move the Magento eCommerce shop from one host server domain to new host server domain or from one directory location to another directory location. Migrating Magento to a new server is a simple task once you know how to do it. This “How to move Magento from one server to another” post will outline the steps involved to successfully migrate a Magento website.

FIRST METHOD

  1. Back up the files in the test server.
    Go to your test site admin backend and refresh Cache by System > Cache Management. Then download and save the whole magento shop root directory via File manager or FTP tools.
  2. Export the magento Database.
    Enter your server control panel phpmyadmin database area and EXPORT your magento shop database in to “name.sql.zip “format.
  3. Move magento files to the new server.
    Upload the root directory (all the files) of your test magento shop backup taken on the step 1 in to the new server domain folder.
  4. Import the database to the new server.
    Go to your new host account phpmyadmin and create a new database, database user and database user password. Then open the database sql file saved on step 2 with a text editor and edit the database name mention in to the new database name, save it. Then import the “name.sql.zip “database backup saved on the step 2 in to this new database.
  5. Update the database details file.
    Next step is to edit the database details file. To do this go to magento live site folder, find out “app/etc/local.xml” file and enter the latest Database details which is created on the step 4.
  6. Modify the base URL database table.
    Next is to replace old server domain name with new domain name. For this go to your new server phpmyadmin magento database and modify core_config_data table as shown below.
    1. web/unsecure/base_url > http://www.newdomain.com/
    2. web/secure/base_url > http://www.newdomain.com/
  7. Refresh cache and Reindex Data.
    The final step is to clear the cache. Go to your sites admin panel (Login with the test site username and password) System > Cache management > Select all & disable cache management. Then navigate through System—>Index Management. Select fields in Status — ‘REINDEX REQUIRED’, then choose ‘Reindex Data’ from drop down and click Submit or delete all the files in “var/session” and “/var/cache” folders of new site.

Take a look to your new magento ecommerce store frontend.

SECOND METHOD

One problem on this method both magento setups must be the same version

  1. Go to your test site backend and refresh cache by system > cache management. Then take a backup of test site phpmyadmin database by exporting database in to “dbname.sql.zip” format (or any suitable format).
  2. Next is to take a backup of below folders on the test site to your system
    1. Contents inside frontend folder (app\design\frontend)
    2. Contents inside frontend folder (skin\frontend)
    3. Catalog & other required folders (media\catalog)
  3. Install a new magento store in to the new server.
  4. Go to the new server phpmyadmin database and delete all the tables.
  5. Unzip backup database on the first step “dbname.sql.zip” and import “dbname.sql” file to the new database.
  6. Copy below folders to their respective new magento server directory
    1. Contents inside frontend (app) folder to app\design\frontend.
    2. Contents inside frontend (skin) folder to skin\frontend.
    3. Catalog & other required folders to media\catalog, xx\
  7. Edit base URL mentioning table (core_config_data table) on the new magento.
    1. web/unsecure/base_url > http://www.newsite.com/
    2. web/secure/base_url > http://www.newsite.com/
  8. Go to your sites admin panel System > Cache management > Select all & disable cache management. And also index data by go to System—>Index Management. Select fields in Status — ‘REINDEX REQUIRED’, then choose ‘Reindex Data’ from drop down and click Submit.

Check your new magento store...

Written by Robin Pakkarambel