1、更换目录名称,新站网站,指向该目录,老站指向新建空目录
2、替换配置文件里包含域名的参数
sed -i 's/旧域名/新域名/g' /www/wwwroot/域名目录/wp-config.php
3、备份数据库,倒入到新建数据库,替换旧域名,把相关字符串也替换了
update wp_options set option_value =replace(option_value,'旧域名','新域名'); update wp_posts set guid =replace(guid,'旧域名','新域名');
4、添加防盗链
sed -i "s/valid_referers none blocked/valid_referers none blocked 新域名/g" `grep valid_referers none blocked -rl /www/server/panel/vhost/nginx`
5、解析dns,生成ssl
6、清除redis缓存,清除网站缓存
cd /www/server/redis/src redis-cli -p 端口 flushall rm -rf /www/wwwroot/新目录/wp-content/cache
7、老站301到新站,保留url参数