您可以使用WP CLI 也无法安全有效地重命名站点的主机名。很可能你的布局被弄乱了,因为用简单的字符串替换域名很幼稚,例如。perl -pi -e \'s/oldhost/newhost/g\' backup.sql
, 不会考虑序列化数据之类的内容。
安装WP-CLI后,请在本地计算机上尝试此操作:
使用db-checkpoint
包装:
wp package install binarygary/db-checkpoint
wp dbsnap pre-search-replace
wp search-replace --precise oldhost newhost
wp dbsnap post-search-replace
wp dbsnapback pre-search-replace
现在,把文件收进来
wp-content/uploads/checkpoint-storage
首先是
post-search-replace
并将其导入远程主机。
无db-checkpoint
:
# Backup your database here, this will be restored to your local once the
# operation is done
wp search-replace --precise oldhost newhost
# Take another backup now - this backup will go to your remote server
# Now, restore your original backup to have your local in a working state...
# OR do this:
wp search-replace --precise newhost oldhost