Gatzet.com

RSS Feed

Gadget, Free Software, Reviews

Moving A WordPress Blog To A New Domain

If you surprised when looking at the domain name of this blog and it shows Gatzet.com instead of Gatzet.info. Yes thats right we are currently moving to the new domain name Gatzet.com and you have arrived at the new one.

Gatzet.Com

When Gatzet.info moved to a new server several weeks ago, it was less complicated than moving from gatzet.info to gatzet.com. We don’t want to lose our old post from .info domain as well as it’s indexed page on search engine after we moved to the new .com.

To ensure all links are not broken when changing the domain name, I have to replace all references pointing to the old domain. Not only on the wordpress theme but most important is on the MySQL database. It sounds insane to edit the database, therefore make sure you have a DATABASE BACKUP READY. In case you made mistake, you can replace the broken one with the original data easily.

I mainly use UPDATE, SET and REPLACE function from within phpMyAdmin to change all obsolete references. Two tables on wordpress database which contains a lot of domain references are wp_posts and in my case wp_postmeta. I used the following sql command to search and replace all gatzet.info with gatzet.com.

UPDATE wp_posts SET `guid` = REPLACE (
`guid`,
‘gatzet.info’,
‘gatzet.com’);

When using the same command on wp_postmeta, I changed the table name and the table field respectively.

UPDATE wp_postmeta SET `meta_value` = REPLACE (
`meta_value`,
‘gatzet.info’,
‘gatzet.com’);

The result will tell you whether your command success or not and how many records were changed. The database is now ready to upload on the new domain. Since REPLACE command is so powerful to ruin your database, make sure EVERYTHING is spelled right and that the value of wp_posts and wp_postmeta.

I copied all files within wordpress directory and move it to the new domain. I also have to edit wp_config.php with a new database configuration (username, password etc) and to edit some url references on the themes as well.

Now the new blog is up and works properly without broken link so far. But this new domain still has no index on the search engine nor visitor. Normal indexing on search engine takes a while and it won’t directly put the new domain on high rank of search result page. Therefore we need to redirect all visitors including search engine crawler from the old .info domain to the new .com. Redirecting is also important to avoid duplicate content on search engine index.

I used the powerful mod_rewrite command to redirect all visitors to the new domain while keeping the same name, directory structure and extensions. We need to redirect users and search engine bots to our new domain via 301 so the visitor will arrived to the new site automatically.

Add the following code on .htaccess file on the old domain!

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ http://www.new_domain.com/$1 [R=301,L]

Hopefully within next 4 to 8 weeks all index on major search engine will be changed referring to the new domain and also keeping the page rank as well.

Bookmark and Share
 

Posted on February 1st, 2008   Tags: · manual editing MySQL, redirect 301, redirecting to new domain

0 comments for this entry ↓

  • There are no comments yet for this entry.

Leave a Comment

All incoming search terms for this post

  • RentMe