How to migrate a WordPress website

Categories

Support

How to migrate a WordPress website

In this guide, we will show you how to migrate a WordPress website from one server to another. While it does seem daunting, this is a relatively simple task to perform.

Method 1. Using a plugin

Our prefered method is to use a plugin, and our preferred plugin is All-in-One WP Migration and it’s available from the WordPress repository.

Part1

  1. In your current WordPress website go to plugins>>add new plugin
  2. Search for All-in-One WP Migration
  3. Click install now followed by activate once the activate option appears
  4. Head to the All-in-One WP Migration option on the sidebar menu and select export
  5. Select export to file from the small drop-down menu
  6. Wait for the site to be backed up then a download button will appear. Click download and download your website.

Part 2

For ease we recommend changing your hosts file on your PC at this point. It will make the following process much easier.

Windows

Windows 10, Windows 8, Windows 7, and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.

For Windows 10 and 8

  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
  5. Make the necessary changes to the file.
  6. Click File > Save to save your changes.

For Windows 7 and Vista

  1. Click Start > All Programs > Accessories.
  2. Right-click Notepad and select Run as administrator.
  3. Click Continue on the Windows needs your permission UAC window.
  4. When Notepad opens, click File > Open.
  5. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  6. Click Open.
  7. Make the necessary changes to the file.
  8. Click File > Save to save your changes.

Windows NT, Windows 2000, and Windows XP

  1. Click Start > All Programs > Accessories > Notepad.
  2. Click File > Open.
  3. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  4. Click Open.
  5. Make the necessary changes to the file.
  6. Click File > Save to save your changes.

Mac OS

Mac OS X 10.0 through 10.1.5

  1. Open /Applications/Utilities/NetInfo Manager.
  2. To allow editing of the NetInfo database, click the padlock in the lower-left corner of the window.
  3. Enter your domain user password and click OK.
  4. In the second column of the browser view, select the node named machines.The third column contains entries for -DHCP-broadcasthost, and localhost.
  5. In the third column, select localhost.
  6. From the Edit menu, select Duplicate. (The quickest way to create a new entry is to duplicate an existing one.)A confirmation alert appears.
  7. Click Duplicate.A new entry called localhost copy appears, and its properties are shown below the browser view.
  8. Double-click the value of the ip_address property and enter the IP address of the other computer.
  9. Double-click the value of the name property and enter the hostname you want for the other computer.
  10. Click the serves property and select Delete from the Edit menu.
  11. From the File menu, select Save.A confirmation alert appears.
  12. Click Update this copy.
  13. Repeat steps 6 through 12 for each additional host entry that you want to add.
  14. From the NetInfo Manager menu, select Quit.You do not need to restart the computer.

Mac OS X 10.6 through 10.12

  1. Open Applications > Utilities > Terminal.
  2. Open the hosts file by typing the following line in the terminal window:
    sudo nano /private/etc/hosts
    
  3. Type your domain user password when prompted.
  4. Edit the hosts file.The file contains some comments (lines starting with the # symbol), and some default hostname mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.
  5. Save the hosts file by pressing Control+x and answering y.
  6. Make your changes take effect by flushing the DNS cache with the following command:
    dscacheutil -flushcache

Part 3

Now that the hosts file has been changed you can see your website on the new server, but it’s not ready yet.

  1. Install WordPress on the new server. On our hosting go to your control panel and scroll down to Softaculous installer at the bottom of the page and select WordPress
  2. Select install
  3. Select the domain name
  4. Remove wp to install in the home directory
  5. Take note of the username and password. You’ll need these, but not for long. You can leave them as admin and pass for now.
  6. Click install
  7. Wait for it to install then open WordPress and login
  8. Following the steps from part 1 install All-in-One WP Migration
  9. If your file is over 500mb you’ll need to buy a licence to use it for the upload, or you can edit a single line of code to upload any size site.
  10. To edit the file open file manager
  11. Go to public_html>>wp-content>>plugins>>all-in-one wp-migration>>contants.php
  12. Search for max upload and locate the following line define( ‘AI1WM_MAX_FILE_SIZE’, 2 << 28 );
  13. change 2 << 28 to a large number such as 9000000000000
  14. Click save
  15. Go back to your WordPress dashboard and go to All-in-One WP Migration >> Import
  16. Drag and drop your downloaded file or select it from the file uploader.
  17. Wait for it to finish uploading
  18. Once finished you’ll be prompted that it will overwrite everything. Select OK
  19. Wait for it to do its thing and another box will appear saying you now need to login and save permalinks twice. This is very important
  20. Click the button and login to the site again
  21. You’ll be on the permalinks page. Scroll down and click save
  22. Scroll down again and click save again

You’re finished. the site has now fully migrated from one host to another. Now you just need to change the DNS settings where the domain name is registered and in a few hours the site will be live on the new server.

 

Method 2. FTP and Database Creation

This method is a little more complex, but overall more reliable. This method suite very large websites with thousands of products or posts

  1. Download an FTP client such as Filezilla
  2. Connect to your website using the FTP credentials that you can find in your control panel. This will be found under FTP connections. You’ll need a url to connect to, username and password as well as a post number if it has been set differently
  3. Once connected you’ll see a folder structure. Head to the location where WordPress has been installed
  4. Once you have located it, select every file and folder and right click to begin downloading. This process can take a long time depending on the size of the website and internet connection speed.
  5.  Disconnect from the old server and connect to the new server and head to public_html
  6. Once in public_html select the downloaded files from your PC and upload them to the new server. this can take quite a while to finish
  7. Once the upload has finished disconnect from the server
  8. Log into the old hosting account and head to PHPMyAdmin
  9. Select the database
  10. Go to the export option on the top menu
  11. Select compression as zip or Gzip file
  12. Go to the bottom of the screen and select go and the database will be downloaded.
  13. Log into your new server and click on MySQL Databases
  14. Click create database
  15. Give the database a name,
  16. Select a user for the database or create one
  17. Create a password and click save
  18. In CPanel select permissions and enable all
  19. Go to PHPMyAdmin
  20. Select the new database which will be empty
  21. Go to the import tab on the top menu
  22. Drag and drop the exported database or select it from the file uploader
  23. Wait for it to fully upload. If you encounter errors during the upload process you can download each table one at a time and upload them one at a time. It is a much slower process, but does allow the importing of very large databases
  24. Once done exit PHPMyAdmin and go to file manager or connect with FTP again
  25. Go to the wordpress installation location and edit the wp-config file
  26. Go to the section where it lists the database name, username and password and enter the details that you used when creating the database
  27. define('DB_NAME', 'db_name');
  28.  define(‘DB_USER’, ‘db_user’);

  29. define('DB_USER', 'db_user');
  30. Click save
Congratulations. You have just migrated a WordPress website.define(‘DB_PASSWORD’, ‘db_pass’);
 

Leave a Reply

Your email address will not be published. Required fields are marked *