Code Snippets

Wordpress: Change domain

2010/05/10 | Comment?

You can move a wordpress website to a new domain with the following two steps:

1. Change all post’s URLs


UPDATE wp_posts SET guid = REPLACE (
guid,
'http://exampleoldsiteurl.com',
'http://examplenewsiteurl.com');

2. Replace the values of ’siteurl’ and ‘home’ in the wp_options table.

You can do it directly by phpMyAdmin or simply putting this lines of code in the functions.php of the theme:


update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');

It is important to execute the previuos code once, then you have to delete this lines.

The official guide is here: Changing The Site URL « WordPress Codex.

Share and Enjoy:
  • Tumblr
  • Twitter
  • FriendFeed
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Sphinn
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • RSS
Tags: , ,

have your say

:

:


«
»