wordpress更改domain域名和數據庫連接


1.0 database connection

define( 'DB_NAME', 'db_table' );
define( 'DB_USER', 'db_name' );
define( 'DB_PASSWORD', 'db_password' );
define( 'DB_HOST', 'db_host' );

  go to {root}/wp-config.php

2.0 change wordpress db table

wp_options -> siteurl = 公众访问的网络位址
wp_options -> home = 公众访问的网络位址

3.0 run sql script to update siteurl & home on post content

UPDATE wp_posts SET post_content = REPLACE(post_content, '{old_domain}/wp-content/uploads', '{new_domain}/wp-content/uploads');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '{old_domain}/wp-content/uploads', '{new_domain}/wp-content/uploads');

  If you save old_domain on wp_postmeta, you will need to update them also.