Skip to content

Instantly share code, notes, and snippets.

@hedii
Created April 21, 2015 11:58
Show Gist options
  • Save hedii/68eb23fe46f7510bea43 to your computer and use it in GitHub Desktop.
Save hedii/68eb23fe46f7510bea43 to your computer and use it in GitHub Desktop.
Move Wordpress from localhost to a server
## Paste all this SQL script in phpMyAdmin (SQL tab) ##
## WARNING: DON'T PUT ANY TRAILING SLASH AT THE END OF THE URL ##
# CHANGE WEBSITE URL
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http://www.oldwebsite.fr', 'http://www.newwebsite.fr')
WHERE option_name = 'home'
OR option_name = 'siteurl';
# CHANGE GUID URL (GLOBAL UNIQUE IDENTIFIER)
UPDATE wp_posts
SET guid = REPLACE(guid, 'http://www.oldwebsite.fr', 'http://www.newwebsite.fr');
# CHANGE POST CONTENT URL
# (LINK, IMAGE, DOCUMENT)
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'http://www.oldwebsite.fr', 'http://www.newwebsite.fr');
# CHANGE POST META URL
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 'http://www.oldwebsite.fr','http://www.newwebsite.fr');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment