How to Successfully Move WordPress Website to new Host Hassle-free?

April 27, 2016 Emily Johns Wordpress

migrating-wordpress

Moving a WordPress website is certainly a challenging task especially when the information available on the Codex offers you a plethora of options and does not have a complete step by step process.

When I had to transfer my WordPress website for the first time, I spent hours finding the relevant information on the internet on an array of aspects of the procedure, and ultimately had to write myself a checklist – which I would want to share with every WordPress user who may need it.

If you have been working with WordPress, you’d probably realize how difficult it is to Migrate website to WordPress or move a site to new host, domain or remote installation. Merely moving the database and files isn’t going to solve the purpose and might break down your website. You are likely to get many internal server and 500s errors because of misconfigured .htaccess file.

So, comprehending the difficulty of moving a site WordPress website, we have written down this detailed post on how to successfully move a WordPress website. We’ll be explaining three different situations of moving a WP powered website, which, according to us, are the most common.

*Transferring a WordPress website from localhost to server

*Transferring a site to the root from a subdirectory

*Transferring a site to a new host or server

Before you even begin the process of transferring, make sure you have taken a backup of your website including your database, the plugins you have already installed and configured, your uploads and your theme files.
Use one of following methods and/or tools to backup your website:

*A backup plugin such as VaultPress, BackupBuddy, WP-DB-Backup which will send a backup

*copy of your site by email.

*A MySQL desktop client

*Terminal commands

*Sequel Pro for OS X

*phyMyAdmin

Moving a website from a localhost to server

Whether you are working as a freelance developer or land a job with a company, moving a site from localhost to server is one of the most common scenarios you come across. Website transferring a site from localhost to server includes moving three primary things – WordPress itself, your themes, plugins and widgets and your database.

1. Turning off Permalinks

wordpress-permalink-settings

Permalinks are a crucial part of a WordPress website which helps in making SEO friendly URLs of your website. In order to get started, you first need to turn off the permalinks which are available in the “Permalinks” page under the “Settings”.
Click on “default” option and hit save changes”.

2. Backup your Database

Backup your database

Now, you need to backup your website’s database. As a matter of fact, backing up your database is extremely important since it has all the data of your website and helps you recover your website if things go wrong. As mentioned earlier, you can use different tools and methods to backup your database.

3. Install WordPress and upload content on the server

Install WordPress and upload content on the server

In your Cpanel, you would get an option to install WordPress. Almost every WordPress website hosting provider offers one-click WordPress installation option.
Now with the help of SFTP or FTP, open your “wp-content” directory and open all the files and paste them into remote “wp-content” directory. Now wait until all the files are copied successfully.

4. Modify the database

modify database

Don’t simply open up your database and start editing it, the serialized database stored might break. Instead, use a tool such as “Search-Replace-DB” to change your local, old URL with remote, new URL.
As an instance, if your old URL is http://localhost/yourwebsite then modify it with http://yourwebsite.com.

5. Drop the existing remote database

Drop the existing remote database

This is a crucial step. Use this step if only you have used software like Fantastico or Softaculous to install WP, since they automatically build a new database whenever you install them. However, if you have manually installed WP, you can overlook this step.
Open your phpMyAdmin and delete your WordPress database.

  • Select the database your website is using and check the “structure” tab.
  • Under the tables list, check “Check All” option.
  • Now select drop from the drop-down menu that states “With Selected” to delete all the tables of the database

6. Upload the new database

new database

Now is the time to upload your new database into your phpMyAdmin. You can upload your database by importing it.

7. Clear the cache

cache-enabler-clear-cache

Though it is not a necessary step, it avoids any issues that may arise if your browser contains cached content of your older database.

8. Test your website

test database setting

Now that you have successfully installed WordPress, copied all the files and uploaded the database successfully, it is time to login into your site, update permalinks and test your site.
To change the permalinks, click on settings permalinks and choose the most relevant option.
Check if all the URLs are working fine abreast the files and pages of the website.

Transferring a site to the root from a subdirectory

Well, this is the simplest move of a WordPress website since you don’t have to move database or files of the WordPress. Best of all, this transfer takes only 5 to 10 minutes as per your setup.

1. Take down your website

First of all, remove your site from the root directory after making a backup of your website database and files and uninstall your WordPress. After deleting your database, delete all of your WordPress files, which basically indicate every folder or file starts with wp.

2. Turn off Permalinks

Permalinks are a crucial part of a WordPress website which helps in making SEO friendly URLs of your website. In order to get started, you first need to turn off the permalinks which are available in the “Permalinks” page under the “Settings”. Click on “default” option and hit “save changes”.

3. Changing your website address

Now you need to alter the address of your site but not your WordPress address.
As an instance, alter the settings as:
Website address – http://yourwebsite.com
Wordpress address – http://yourwebsite.com/example
Hit save changes.

4. Copy and change two files

Connect using SFTP or FTP or even Cpanel and copy and paste “index.php” and .htaccess files from the subdirectory to the root directory.
Alter the index.php file by adding a line of code at the end of the file
require (‘./subdirectoryname/wp-blog-header.php)
For instance, if you have been building a site in yoursite.com/example, merely change the line to
require (‘./example/wp-blog-header.php)
Hit save changes.

5. Turn your permalinks on and test your site

To change the permalinks, click on settings → permalinks and choose the most relevant option.
Check if all the URLs are working fine abreast the files and pages of the website.
Transferring a site to a new host or server
This method is required when you are planning to switch your hosting services and need to move your site from host to another.

Note: A majority of web hosting service providers offer a free or affordable migration services. If they haven’t mentioned it on their website, you can contact them and ask. Often it is for free of cost, but some service providers might charge a small amount. Well, it is best for those who are not very technically sound and does not want to mess around with the website.

The process of moving a website between two hosts is almost same as that of moving a site from localhost to remote server but still I am explaining the whole thing from beginning to end in steps to avoid any confusion.

1. Turning off Permalinks

Permalinks are a crucial part of a WordPress website which helps in making SEO friendly URLs of your website. In order to get started, you first need to turn off the permalinks which are available in the “Permalinks” page under the “Settings”.
Click on “default” option and hit save changes”.

2. Backup your Database

Now, you need to backup your website’s database. As a matter of fact, backing up your database is extremely important since it has all the data of your website and helps you recover your website if things go wrong. As mentioned earlier, you can use different tools and methods to backup your database.

3. Download Website files

Connect with your website through SFTP or FTP to access the wp-content folder to download all the files onto your computer.

4. Install WordPress and upload content on the server

In your Cpanel of your new host server, you would get an option to install WordPress. Almost every WordPress website hosting provider offers one-click WordPress installation option.
Now with the help of SFTP or FTP, paste all of your files which your downloaded from your old website onto your website into the new website’s “wp-content” folder. Now wait until all the files are copied successfully.

5. Upload the database

The database you downloaded from your old website in step 2, it’s time to upload it to your new host. Open phpMyAdmin of your new site, create a new database and import the file. Once imported successfully, you should see all the tables in your database.
Note: Take a note of the database name you’ve kept for your new database, it would be required in the further steps.

6. Change WordPress credentials

Open your “wp-config” file of the new website and alter three important values – DB-PASSWORD, B-USER, and DB-NAME.
Change these values with the new database values such as DB-NAME with the new name you’ve kept for your database and similarly change the other values.

7. Switching Nameservers

 

Change-nameservers

Now you need to change the Nameservers of your domain to ensure users are able to access your website on the new host. If you bought a domain name from domain registrars such as Namecheap or Godaddy, you would certainly need to change your nameservers.
Your new web hosting service provider will provide you all the information related to Nameservers. These nameservers usually look like this:
ns1.hostname.com
ns2.hostname.com
Open you account with the domain registrar and click on domain management area to have access to name servers. Click on the change to update the nameservers and paste in the new nameservers your web host has provided you.

8. Test your website

Check if your website is running properly and redirects to your new host.

Congratulations, you have successfully transferred your WordPress website without any problem.

Conclusion:

Well, a WordPress website can be transferred in many ways, however, we have mentioned one of the easiest ways to do so.
I hope you have found this post useful. Don’t forget to share your reviews and experiences with us and our audience in the comments section below.