Move entire WordPress site to a new domain

Move entire WordPress site to a new domainThere are times that you wish to move from one domain name to another for your WordPress site. We recently registered/acquired the .com version of one of our domains. The domain was a deleted domain that has been dropped by the person who registered it two years ago.

If you can, you naturally want a .com domain for your wesite. Make no mistakes, .com is still the king of the Internet.

Move a WordPress site to a new domain is not that difficult; it can be an easy, smooth and stress-free experience if you follow the following simple steps.

WordPress.org’s own guide Moving WordPress somehow is a bit confusing, but it is a very good starting reference. Please read it before you embark on the moving.

How to move a WordPress site to a new domain?

Step 1.
Back up your database, using mysqldump or other means. It is extremely important. 99.9% of the times, this will not be necessary, but if by a slight chance you mess out the whole process and database, you can always fall back to your old domain with your old database. And restart again.

Step 2.
Turn off Content Delivery Network (CDN) connection if you are using one. Then create a new zone and get all the required connection elements for the new domain. Those will be used later. If you are totally sure, make a note of what you are currently using for your old domain with the CDN provider, so you can replicate them with the new domain.

Step 3.
Log in as admin; go to Administration > Settings > General panel. Change WordPress Address (URL) and WordPress Address (URL) to your new website address.
Click Save Changes. And DO NOT open/view your website/blog now!!!

Step 4.
Move all your WordPress website files to the new location. This includes the files found within the original directory and all the sub-directories, to the new location. If your web hosting provider allows you to change domain mapping directory, you don’t need to copy/move, just swap old and new domain mapping directories.

Step 5.
Update existing image/media links – the uploaded media will refer to the old URL/folder and must be updated with the new URL/location. Use Velvet Blues Update URLs plugin to update database. Now you can login your new site, install the plugin and update the URLs. Uninstall and remove the plugin once you are done.

Step 6.
If you are using a cache system, such as W3 Total Cache, you may be asked to update your .htaccess file. Chmod 777 the file, and let the plugin do the work. Remember to chmod 644 the file afterwards.

Step 7.
Now your site should be working just like your old site. If everything works, turn on CDN using the new domain information.

Step 8.
Re-direct your old site traffic.
Now you have moved your website, your visitors to your old website via search engines, social networking sites, back links will be unpleasantly greeted with a blank page or a 404 notfound error. This is “the most effective and fastest way” to lose your readership and most importantly whatever SEO you have built into your old website may be lost.

The best way of seamlessly redirecting traffic from old website to the new one is using mod_rewrite in .htaccess file. Create a .htaccess file in your old website directory (there should be no other files left if you have moved all the files to the new location), and copy the following codes into the file and save.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.myoldsite.com$ [NC]
RewriteRule ^(.*)$ http://www.mynewsite.com/$1 [R=301,L]

Test it and it should redirect something like “http://www.olddomain.com/home” to “http://www.newdomain.com/home” The R=301 will tell Google and other search engines that this redirect/modification is permanent, and that they should update all of their links and rankings to reflect the change.

It may take long time for the search engines to phase out your old domain links, so just keep the re-direct and ignore your old domain. If you need to do something with your old domain, do a search a year or so later (depending, but check search results regularly) to see if you still have oldsite links in the search results. The bigger your site in the number of contents, the longer you may need to keep the re-direct to get your search results fully phased out. Then again, you have a large site, it may not be a wise move to change domains. The higher the PR of your site, the quicker your contents may be phased out. If very few links are left, then you may remove the re-direct and re-use your old domain.

Reference: Redirecting Traffic from an Old Site to a New One

Warning: Moving your WordPress website will incur penalties with PR rank and you will have to rebuild your PR again. So think twice before you make the move.

Step 9.
Google Webmaster Tools: add the new site, verify your new domain, and add new sitemap. Update your robots.txt file with new domain name. Update your internal backlink, pointing to the new domain, Update your social media account with your new domain. If you are using Google Analytic and other web tracking systems, update them also.

Note: You may want to submit change of web address through Google Webmaster Tools. You will be asked to verify the old domain either or both www and non-www version. Download the verify html file and upload to the old domain. Be sure to comment out (#) .htaccess redirect rules before verification, otherwise you will not be able to verify the domain.

Step 10.
You are done and go out and rebuild backlinks to your new site to regain your PR rank!

Side-note:
It took about 45 days from the .com domain expiry to its becoming available for registration.

Funny thing is that once it became available and while we were in the process of registering the domain, those very nice gentlemen from secureyourdotcom.com sent us an email, wanting to sell the domain to us (they got our email because we had registered the .net version for backup, just in case we will not be able to get the .com) for mere $99, including one full-year domain registration. What a bunch of thoughful gentlemen. Thank you guys, we can register ourselves and use that money to register the domain for 10 or more years. Why should we give you the money so you can register the domain under your name with our money, then transfer the domain to us?