I moved a WordPress blog to a new server and a new address this week. It was one of those jobs that I dreaded doing but didn’t turn out to be too complicated. And I’ve not lost any traffic!
Why was I moving a WordPress site to a new domain?
A few months back I created a site about WordPress, blogging, SEO, SM and internet marketing. I called it (maybe I didn’t spend too long thinking about this) WordPressSEOMarketing.com – catchy, huh?
It turns out that it is illegal to use “WordPress” in a domain as it is copyrighted. I spent a lot of time trying to decide on a new domain name for the website. In the end, I decided on WPBlogTalk.com.
How to move a WordPress site
Here is a basic synopsis of what you need to do.
- Register the new domain with GoDaddy or Namecheap or some domain name registrar
- Point the Name Servers at the domain name registrar to the new host
- Set up the new domain at the new host
- Copy all files and database (see below) from old site to new site
wp-config.phpto have the right database settings and add code for new domain (see below)
- Install the Search and Replace plugin to search for old URLs and replace them with the new URL
- Go through new site checking links, etc., change logo and branding, create new email subscription, change any product URLs, etc.
- Add 301 redirection from old blog to new blog
- Change feed URL in Feedburner, set up new Google Webmaster Tools and Google Analytics accounts to monitor indexing and traffic of new site
Now, what could be simpler?
If you don’t count waiting for files to copy, the actual process of moving a WordPress site only takes a few minutes – but you need to spend time checking the new site and changing some superficial elements.
The first three steps of the above synopsis are simple enough. And copying the files is an easy job to do with any FTP client. However, copying a database is always a little more complicated.
If you have Shell (Telnet or SSH) access to the hosts this can be done with one simple command line:
mysqldump -h oldhost -u oldusername -poldpassword olddbname | mysql -h newhost -u newusername -pnewpassword newdbname
This maybe a good option if your database is over 7MB in size. However, I prefer a more “hands-on” approach and migrated the database with PHPMyAdmin.
Exporting a database with PHPMyAdmin
Firstly, you need to export the database from the old site. Once you have logged in to PHPMyAdmin, selected the WordPress database on the left-hand panel and clicked the Export tab on the top right, there are a few options you must set in this page.
Underneath the section marked “Export”, make sure you have clicked “Select All” and in the radio button list below, make sure SQL is selected (this maybe already done when you arrive a the Export page). In the section marked “Structure”, check the box marked “Structure”. Within this section check boxes marked Add DROP TABLE / VIEW / PROCEDURE /, Add AUTO_INCREMENT value, and Enclose table and field names with backquotes. In the section marked “Data”, check the box marked Data. Within this section check boxes marked Complete inserts, Extended inserts and Use hexadecimal for binary fields.
Finally, check the box marked Save as file in the bottom panel and click the radio button with compression as None. Then click Go bottom right and go and get yourself a coffee.
Here is the complete panel to export or back-up and WordPress database in PHPMyAdmin:
This is the same procedure as when backing up WordPress databases. You can get a plug-in to do this for you but as this is for a new WordPress website, I thought it was better to export it this way.
Importing a database with PHPMyAdmin
Secondly, you need to create a new database on the new server and import the database you just exported.
I created a database with completely different name, username and password but you could be clever and create one with the same names and passwords as the old one which would mean you wouldn’t have to change these in the
wp-config.php file later on.
In order to import the old database into the old one you need to open PHPMyAdmin for the new database that you have just created.
Click the small SQL icon, select Import Files from the resulting pop-up window, click Browse, select the file from your computer that you’d downloaded from the old site, and then click Go.
If the database imported still has the old website URL in it, you need to add these lines to the
I also had to change the database name, database username and password in the wp-config.php file to the settings of the database I’d just created.
At this point you can have a look at the new site and click through a few links. There’s still plenty more to do, though.
Search and Replace plugin
Meet your new friend, the Search and Replace plugin. Install this plug-in on your new site to change all the mentions of the old domain and change them to the new one. There are two places you can do this in the plug-in’s options page. I performed the search and replace in both.
If you search through all your posts now you will find all the internal links and image paths are using the new domain.
Check the site
Have a good look through your new site, checking that all is as it should be. Here’s a few things that I needed to do:
- Change image paths and internal links in the text widgets (for some reason these don’t get picked up by the Search and Replace plug-in)
- Change the logo in the header
- Create a new Aweber list for email subscriptions
- Re-brand e-books offered for download on the site
- Change the download page in Clickbank for a premium product
I actually found that these actions took the most time of the whole process!
Re-direct old site to new site
This step is absolutely essential!
You now have two sites that are identical in content – a bit of an SEO no-no. You need to set up a 301 re-direct from the old site to the new site. Put this in the old site’s .htaccess file – which you will find on the root of the site.
Redirect 301 / http://www.wpblogtalk.com/
That’s all you need! That will redirect any URL in the old domain to the equivalent page in the new site.
Finally, I performed these following steps:
- delete the files and database of the old site (keep that all important .htaccess file though!)
- change the feed URL at Feedburner
- set up a new Google Analytics account
- set up a new account at Google Webmaster Tools to monitor how many links are indexed and register the sitemap
- create a new robots.txt to point to the sitemap
- create a new email address for the site and make sure the content form points to it (and forward emails from the old email address for the site to the new one)
Moving a WordPress website from one URL to another
Here is a video I made for your viewing pleasure concerning all the main points of copying files and databases, setting up the new WordPress site and redirecting the old site to it.
You’ve made it to the end of the article now!
I hope that helped someone. Please let me know if you do it differently or if you’ve had a problem with this operation in the comments below. And, if you’ve enjoyed the article, please don’t hesitate to vote for it down below!