Here are the steps to migrate Magento site to a new host/domain.
Table of Contents
Step 1: Backup your files
Click here for our guide on how to take a files backup.
Download the files backup at a safe location and proceed to the next step.
Step 2: Backup your database
Click here for our guide on how to take a database backup.
Step 3: Create Database on the New Host
Click here for our guide on how to create a new database
Make sure that you write down the database name, username and its password. You will need them in the step 5.
Step 4: Import the database
Click here for our guide on how to import a database. If your old database is bigger than what you host allows you to upload, try gziping the sql file. phpMyAdmin allows you to import gzip files.
Step 5: Upload the files and update the configuration files
Edit the app/etc/local.xml file with the new database details from Step 3.
<connection> <host><![CDATA[YOUR_DATABASE_HOSTNAME]]></host> <username><![CDATA[YOUR_DATABASE_USERNAME]]></username> <password><![CDATA[YOUR_DATABASE_PASSWORD]]></password> <dbname><![CDATA[YOUR_DATABASE_NAME]]></dbname> <active>1</active> </connection>
Step 6: Update folder permissions
You might get “Internal Server Error” if your Magento files and folders permission is not correct. All files should have 644 permission and folders should have 755 permission. Only ‘media’, ‘var’, and ‘app/etc’ folders should have 777 permissions
Step 7: Clear cache
Delete all contents of “var/session” and “/var/cache” folders.
Additional step: If you are moving to a new domain
You need to update base URL to your new website’s URL. In the below sql statement, change newsite.com to your new website URL.
UPDATE core_config_data SET value='http://newsite.com/' WHERE path='web/unsecure/base_url'; UPDATE core_config_data SET value='https://newsite.com/' WHERE path='web/secure/base_url';
Make sure you let the search engines know about the new domain. You can create a 301 redirect from your old domain to the new one. Click here for our guide on how to do a 301 redirect.