Pawel Szulencki Search Engine Optimization/Marketing blog.
If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting!
If you decided to move your WordPress blog to a new, dedicated domain you are probably wandering how to use 301 permanent redirect to keep the traffic to your site from external sources. This guide will help you to get thought the whole process.
First you need to copy all files of your WordPress blog to the new location where your new domain name is parked.
After you do that you need to change the URl of your blog to the new one. Login to your OLD blog on OLD domain and go to Settings page. Change the WordPress address (URL) and Blog address (URL) to the NEW domain name.
Using your hosting provider PhpMyAdmin panel put the following command in the SQL tab:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
This will change your blog location settings in your WordPress blog SQl database.
When you do that you will still need to update a lot of things in your new blog, such as all post URL paths. If your blog is very big it might take a very long time to update all posts manually. But there is an easy fix for that.
To update all post URL’s to the new domain name use the following code:
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
If you have linked internally between posts those posts will point to an old domain name. We need to change that with a simple SQL update:
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
After you have moved you files and updated your SQL database you would probably like to redirect your old domain to the new one, so all traffic remains the same. The best way of keeping the traffic to your new domain name which will also transfer the link juice and Google Pagerank to the new domain name is thought a file called .htaccess
You need to create a .htaccess file in your Notepad and place it in the OLD domain name ROOT FOLDER (the folder you kept the old WordPress blog at). The .htaccess file should have the following lines of code inside:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com
RewriteRule (.*) http://www.new-domain.com/$1 [R=301,L]
This will permanently redirect all traffic from OLD domain to NEW one keeping the structure of posts/pages.
For example if someone will follow an old link to your blog from a search engine to http://www.old-domain/index.php/post-name/ they will be redirected automatically to http://www.new-domain/index.php/post-name/ and so on.
You don’t have to be worry about lost traffic, lost inbound links atc. as it will be redirected to your new domain name. You can also ask other webmasters to update the links pointing to your site.
You should also keep your old domain name with the .htaccess file for about 6-12 months until search engines will follow the new blog address and index your content again.
NOTICE: You need to change http://www.old-domain.com to your old domain name and http://www.new-domain.com to your new domain name.
NOTICE: This guide works in situation you do not change the server provider of your blog. If you change the server you also need to transfer your whole SQL database, change passwords etc. This guide is not explaining those steps.
References:
SQL codes from mydigitallife.info
Pawel Szulencki is a SEO (Search Engine Optimization) and Marketing certified specialist who is interested in organic SEO, paid campaigns (PPC) and Social Media Marketing channels. (Read more)
brainpicker (3 comments.)
August 23rd, 2008 at 5:57 pm
Hey, this was tremendously helpful, thanks. Only one problem though: I do happen to be moving hosts as well, so do you have any tips/tutorials on moving said SQL database + changing passwords? Thanks man.
Pawel Szulencki (92 comments.)
August 23rd, 2008 at 6:15 pm
Im very pleased to hear that you enjoy my advice and im also very happy to get some feedback to my articles. I will prepare appropriate guide concerning moving WordPress blog with host change soon and publish it at SEO/SEM blog. I will notify you about that post when i publish it.
brainpicker (3 comments.)
August 23rd, 2008 at 8:10 pm
Thanks Paul, much appreciated. Meanwhile, I found some marginally helpful articles on the matter, if you care to take a look:
http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_to_a_New_ Server
http://technosailor.com/2007/04/06/wordpress-faq-how-do-i-move-my-blog -to-a-new-host/
http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to -new-domain-or-location/
I think between those and what you have up here, the process shouldn’t be too bad. I’d still love to read your expert take on it though.
brainpickers last blog post..Quick Brains-Up
Pawel Szulencki (92 comments.)
August 25th, 2008 at 10:28 am
Ok, “How to move WordPress blog to a different hosting provider” ready at http://www.seoblogr.com/index.php/archives/how-to-move-wordpress-blog- to-a-different-hosting-provider/
Hope it helps.
Shirley (3 comments.)
October 4th, 2008 at 9:18 pm
For many WordPress newbs, PHPMyAdmin and SQL can be scary, even if it is a simple replace function.
We just released a plugin to simplify this process. It can be found at http://www.velvetblues.com/web-development-blog/wordpress-plugin-updat e-urls/
Shirleys last blog post..WordPress Plugin: Update URLs
Pawel Szulencki (92 comments.)
October 5th, 2008 at 2:24 pm
@Shirley: Thanks for the plugin. It looks very interesting and helpful.
Chris Yeung (2 comments.)
January 3rd, 2009 at 8:43 am
I followed your steps to transfer http://ideasworthreading.com to http://booksinpowerpoint.com/blog.
Everything on the front page displays properly, but if I click on any link I get:
“Not Found
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”
Chris Yeung (2 comments.)
January 3rd, 2009 at 9:21 am
Scratch that. Somehow it fixed itself. Thanks Pawel for this tutorial.
Pawel Szulencki (92 comments.)
January 3rd, 2009 at 12:21 pm
@Chris Yeung: Sometimes you just need to wait as cached pages may still be displayed. The cache needs to be deleted and everything should be fine. Im glad it worked for you too.