Do you remember a couple of months ago we changed our WordPress site domain name and re-branded it from SharePress.org to DataReign.com. A quick change within 20-30 minutes that didn’t effect our WordPress site or our traffic. It’s easy and something you should do carefully as any small mistake you will end up in a chunk of WordPress errors, annoying your visitors and loose out from the search engines.
Here some simple steps for anyone trying for a WordPress domain change without annoying their visitors and search engines –
- First Backup everything – Make sure you have an entire backup of your WordPress database and all the files. Then disable any cache plugins you have installed like W3Total cache or WP Super Cache, as it may confuse you in your domain change with all the cached contents.
- Setup new Domain – Setup the new domain under your hosting provider and then add a robots.txt file in the root directory with following content
User-agent: * Disallow: /
This will make sure , what ever you do now on the new domain will not be indexed by the search engines.
- Copy or Move all your WordPress database and files to your new domain (create a new database and import the old WordPress database to it)
- Change wp-config.php to reflect your new database setting and also set the new domain name in it –
define( 'DB_NAME', 'new_database_name_here' ); define( 'DB_USER', 'username_here' ); define( 'DB_PASSWORD', 'password_here' ); define( 'DB_HOST', 'localhost' ); define('WP_SITEURL', 'http://www.example.com'); define('WP_HOME', 'http://example.com/wordpress');
- Next step your blog under your new domain name with the same settings as on the old domain
- Now the important part, your blog under the new domain will have some URLs, especially image links with old domain URLs, we need to change that. For that install the Search and Replace plugin that will search for old domain URLs in your database and replace it with your new domain URLs.
- You are done, now remove the content we earlier have placed from the robots.txt file. Your WordPress site is now Live on the new domain and its fully search engine index-able. Do check your site in new domain name and make sure everything is working as usual.
- 301 Redirection on old domain name – with the domain name change we should also make sure all traffic to the old domain is fully redirected to the new domain name. For that add the following code to your .htaccess under your old domains root directory.
Redirect 301 / http://www.example.com/
- For better search engine optimization purpose update your Google webmaster and Bing Webmaster tools with your new domain. On Google webmaster you need to first add and verify your new domain name. Then under the old domain name use the Change of Address tool to notify Google of your site’s move. Use also the Fetch as Google tool to ask Google to crawl your new site. By doing this you will be able to retain your previous backlinks and ranking for your new domain.
On Bing webmaster you just need to add the new domain becuase you will not be able to retain your previous backlinks and ranking. Transferring your new site to webmaster would give you a fresh start just as if you submitted a new site to be verified.
- Update your Feedburner with the correct RSS feed and do also update your Social networking accounts with you new domain.
Everything is done, you have successfully moved your WordPress to a new domain without much effecting the site and search engine. If you have any sorts of doubts or suggestion do let me know through your valuable comments.