Revision 395 is a pre-publication revision. (Viewing current revision instead.)

How to Move a WordPress Website Using MYSQL and phpMyAdmin

Taken from here: http://www.designshifts.com/how-to-move-a-wordpress-website-using-mysql-and-phpmyadmin/

You will need access to your phpMyAdmin or login to the DB server and run MySQL client as root. Use the following SQL command to update the new location of your WordPress website URL:

[php] UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://www.new-example.com') WHERE option_name = 'home' OR option_name = 'siteurl';[/php]


After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guide field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

[php] UPDATE wp_posts SET guid = replace(guid, 'http://www.example.com', 'http://www.new-example.com');[/php]


If you have created reference backlinks within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all the internal links:

[php]UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
[/php]


Revisions

  • April 2, 2013 @ 02:58:51 [Current Revision] by PeterLugg
  • April 2, 2013 @ 02:56:21 by PeterLugg

Revision Differences

April 2, 2013 @ 02:56:21Current Revision
Content
 Added: <p>Taken from here: <a href="http:// www.designshifts.com/how- to-move-a-wordpress-website- using-mysql-and- phpmyadmin/" target="_blank" >http://www.designshifts.com/ how-to-move-a- wordpress-website- using-mysql-and-phpmyadmin/ </a></p><p>You will need access to your phpMyAdmin or login to the DB server and run MySQL client as root. Use the following SQL command to update the new location of your WordPress website URL:</p><pre>[php] UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://www.new- example.com') WHERE option_name = 'home' OR option_name = 'siteurl';[/php]</pre><br /><br /><p>After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guide field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:</p><pre>[php] UPDATE wp_posts SET guid = replace(guid, 'http://www.example.com', 'http://www.new- example.com') ;[/php]</pre><br /><br /><p>If you have created reference backlinks within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all the internal links:</p><pre>[php]UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old- domain.com', 'http://www.new- domain.com');
Deleted: Added: [/php]</pre><br /><br />

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply