wordpress怎样更换域名

1、做好网站备份。网站文件和数据库都要进行备份。

2、做好新网站的域名解析

3、新网站重新wordpress程序,注意:数据库前缀要和原来数据库一致,默认是wp_

4、安装完成之后导入原来的数据库到新的数据库中,导入方式不在描述。

5、最重要一步,修改数据库的表,最好加上http或者https,最好把带www和不带的都更新一下。

下面以从https://www.cnbugs.com改为https://www.cnbugs.com为例

进入

mysql> UPDATE wp_cnbugs_options SET option_value = replace(option_value, 'https://www.cnbugs.com','http://www.centosnett.com');

Query OK, 3 rows affected (1.37 sec)
 Rows matched: 149  Changed: 3  Warnings: 0
mysql> UPDATE wp_cnbugs_posts SET post_content = replace(post_content, 'https://www.cnbugs.com','http://www.centosnet.ccom') ;

Query OK, 36 rows affected (0.71 sec)
Rows matched: 188  Changed: 36  Warnings: 0
mysql> UPDATE wp_comments SET comment_content = replace(comment_content, 'https://www.cnbugs.com', 'https://www.cnbugs.com') ;

Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0
mysql> UPDATE wp_cnbugs_comments SET comment_content = replace(comment_content, 'https://www.cnbugs.com', 'http://www.ccentosnet.com') ;

Query OK, 0 rows affected (0.05 sec)
Rows matched: 0  Changed: 0  Warnings: 0
mysql> UPDATE wp_cnbugs_posts SET post_content = replace(post_content, 'https://cnbugs.com','https://www.cnbugs.com') ;

Query OK, 0 rows affected (0.01 sec)
Rows matched: 188  Changed: 0  Warnings: 0

发表评论

后才能评论