Knowledge Base
MilesWeb / How-Tos

Learn to Move Your Magento Store From One Server to Another

Approx. read time : 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

Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.

Trusted By Thousands of Clients & Big Businesses

We highly appreciate the kind and stellar feedback we receive from our customers. Delivering the best is our goal! MilesWeb is rated Excellent out of 5 based on reviews. Read more reviews.

Excellent
Based on reviews
2 hours ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
4 hours ago
Milesweb is superb Hosting pro...
Milesweb is superb Hosting provider ever, their Support team is amazing!!!...
Abhishek Singh
15 hours ago
Great support in great timing...
We need urgent assistance on changes in a primary domain on our client's Cpanel accounts and reached...
Riyaju Deen
21 hours ago
Best Website Hosting platform ...
I was new on MilesWeb. And needed help on multiple areas from setting up to getting started with cre...
Harshada
1 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
1 days ago
the team is very supportive th...
the team is very supportive though at times effort needs to be made to make understand the problem s...
Suree Sharma
1 days ago
I am using miles web for 3plus...
I am using miles web for 3plus years, very quick and perfect support by the team, they helped me man...
Sri Raghav
2 days ago
The service is good...
The service is good. They are answering with patience and doing the needful as soon as possible....
MR
2 days ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
3 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
4 days ago
positively helped me with find...
positively helped me with finding insecure content on my website causing SSL to not work properly on...
Thaviraj Junglee
4 days ago
Exceptional support, Truly Pra...
I had opted for the basic wordpress hosting plan as I intended to experiment with various plug-ins. ...
Aseem Chandna