1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5 out of 5)
Loading ... Loading ...

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

Sphere: Related Content