曲线球将WP站点克隆到新URL

时间:2020-03-07 作者:davidgo

I am scratching my head, and wonder what I\'m missing here. I have done this kind of cloning lots of times, and never had an issue before. I am a Linux systems administrator by trade with significant exposure to Wordpress, but not a Wordpress expert.

I have attempted to clone a specific wordpress site (I\'ve tried it more then once, in case I made any stupid mistakes), but I can\'t get it working. I have

  1. Dumped DB from old site.
  2. Copied files from old to new site, and updated file permissions.
  3. Done a global URL search on replace on the database for the domain name in question.
  4. Done a global search and replace on all files for the domain name in question
  5. Modified wp-config.php appropriately for the new DB and loaded it in.
  6. Checked, double checked, triple checked the above. Also checked for path related problems. Can\'t find anything.
  7. Disabled all caching I could find, including looking for caching files and plugins. Including on server and locally.
  8. Checked that the server I am visiting and cloning is the correct one.

The site in question uses Beaver Builder. One interesting datapoint is that on the new version of the site the menu does not work - it displays "CHOOSE MENU". When logged in and clicking on that Choose Menu icon it takes me to the main menu which is there.

I have no problem logging into the backend, and can see all the data that should be there.

If I clone the theme to a different server and keep the domain name the same (and use a hosts file) everything seems to work? The problem appears to relate to the changed URL.

I\'ve tried disabling all the plugins (bu renaming the plugins folder). Did not make any difference.

Anyone seen something like this before? Anything I\'ve missed?

1 个回复
最合适的回答,由SO网友:davidgo 整理而成

解决方案是更改数据库迁移的方式。我将其转储,进行搜索和替换,然后加载修改后的数据库。我发现这会破坏序列化。

有效的解决方案(我现在认为这是一种最佳实践)是转储和加载数据库,不做任何修改。使用WPCLI搜索和替换正确处理序列化的链接。这样做的语法是

  wp search-replace "https://old.url" "https://new.url"

相关推荐