Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  Learn to Move Your Magento Store From One Server to Another
Top Scroll

Learn to Move Your Magento Store From One Server to Another

 3 min

It is very difficult to move any kind of application between servers. Even with Magento you face lot of challenges. Therefore, here’s a step by step guide to learn about moving your Magento online store from one server to another.

When you transfer a Magento website there are some things that you need to worry about as compared to downtime. Let’s check the steps.

Prerequisites

  • Root access to both servers
  • cPanel or knowledge on creating virtual host on the new server

Step 1. Inform the Store Administrators About the Transfer

Firstly, inform the Magento administrators to stop working on the store. Or else, things might get lost in the process.

Step 2. Create An Account on New Server

Using the same username for user, create an account on the new server where you are going to transfer your store.

Step 3. Create New databases and Users on the New Server

On the new server after logging, create new databases and users by replicating settings from the old server.

You will find this data in your document root (on old server) for Magento within app/etc/local.xml.

Step 4. Backup public_html folder

Then you need to take the backup public_html folder by going to your account:

cd /home/username/
tar -zcvf archive.tar.gz public_html

Step 5. Dump Databases from Old Server

Now, dump database(s) from old server using the mysqldump option for taking the backup of your database instantly.

Step 6. Move Databases to a New Server

Move the archive.tar.gz, and databases to the new server using scp as below:

scp archive.tar.gz root@new.example-server.com:/home/username
scp *.sql root@new.example-server.com:/home/username

Step 7. Import the Database Backup

Next, just import the database backup from the dump file. Sometimes it is difficult to import the dump of the database using PMA. So, it is better to upload database to a server and import it via command line interface (CLI).

Use the below command to import database with CLI:

cat database_name.sql | mysql -uusername -puser_password database_name

Step 8. Configure New Server public_html

You need to configure new server public_html using the below command:

mv public_html public_html_backup
Unarchive archive.tar.gz: tar xvfz archive.tar.gz
Set privileges: chown -R username:username public_html
Set public_html group to nobody: chown username:nobody public_html

Step 9. Create a New Subdomain

Create a new subdomain and modify your Magento install to load from this domain.

In your cPanel, create subdomain: new.yoursite.com

Then go to PhpMyAdmin and edit database core_config_data and change yoursite.com to new.yoursite.com for path: web/secure/base_url and web/unsecure/base_url

Step 10. Getting 500 Error

If you are getting 500 error, go to public_html dir, and run the below two commands:

find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;

Step 11. Ensure Your Website is Working

Ensure that your website on new.yoursite.com is working properly

Step 12. Redirect DNS

Redirect your DNS by running Rsync from current server to ensure that all your files (especially session) are in sync with the new server as below:

rsync -avz public_html/ root@new.example-server.com:/home/username/public_html/

That’s it! You have learned to move your Magento store from one server to another.

Also Read:
Learn to Transfer Magento Website from Localhost to Server
Learn to Enable and Disable Magento Maintenance Mode

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.