Skip to content

Instantly share code, notes, and snippets.

@arnorhs
Created March 11, 2011 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnorhs/866373 to your computer and use it in GitHub Desktop.
Save arnorhs/866373 to your computer and use it in GitHub Desktop.
The SQL you need to execute to change a Wordpress site from one host to the other
# Update the options for site settings:
UPDATE wp_options
SET
option_value = replace(
option_value,
'http://oldsite.com/path',
'http://spankingnew.com/otherpath'
)
WHERE
option_name = 'home'
OR
option_name = 'siteurl';
# Update the post contents and the post slugs/urls at the same time:
UPDATE wp_posts
SET
post_content = replace(
post_content,
'http://oldsite.com/path',
'http://spankingnew.com/otherpath'
),
guid = replace(
guid,
'http://oldsite.com/path',
'http://spankingnew.com/otherpath'
);
<?php
// In /wp-config.php, add this:
define('WP_HOME','http://spankingnew.com/otherpath');
define('WP_SITEURL','http://spankingnew.com/otherpath');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment