Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于如何使用搜索和替换工具脚本将WordPress从本地迁移到在线服务器的疑问_Wordpress_Content Management System - Fatal编程技术网

关于如何使用搜索和替换工具脚本将WordPress从本地迁移到在线服务器的疑问

关于如何使用搜索和替换工具脚本将WordPress从本地迁移到在线服务器的疑问,wordpress,content-management-system,Wordpress,Content Management System,我正在尝试将我的博客从本地web服务器迁移到在线web服务器,对此过程我有疑问 我已将所有本地文件上载到web服务器的根目录中 我还使用phpMyAdmin导出了本地数据库的表,并将它们导入到我的在线数据库中 然后我更改了文件wp-config.php中的设置,以便与在线数据库建立连接 现在,我必须使用搜索和替换工具脚本更改数据库上的URL设置: 因此,我对搜索和替换脚本的使用有以下疑问: 我必须将searchreplacedb2.php文件放入我的Web服务器的根目录中,其中是wp-confi

我正在尝试将我的博客从本地web服务器迁移到在线web服务器,对此过程我有疑问

我已将所有本地文件上载到web服务器的根目录中

我还使用phpMyAdmin导出了本地数据库的表,并将它们导入到我的在线数据库中

然后我更改了文件wp-config.php中的设置,以便与在线数据库建立连接

现在,我必须使用搜索和替换工具脚本更改数据库上的URL设置:

因此,我对搜索和替换脚本的使用有以下疑问:

我必须将searchreplacedb2.php文件放入我的Web服务器的根目录中,其中是wp-config.php文件,并且必须执行此脚本吗

2我必须浏览所有表格还是只浏览posts表格

Tnx


Andrea

我不知道您建议的脚本,但我总是使用直接的mysql查询,如下所示:

/**
To update WordPress options with the new blog location, use the following SQL command:
**/

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

/**
After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as abolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:
**/

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

/**
If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:
**/

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

注意:自从我编写此脚本以来,wp DB结构中可能发生了一些变化,因此为了以防万一,在使用它之后,转到wp_选项表并仔细检查HOME和BLOG url条目,以查看它们是否会标记您的新域。

更安全的选择可能是利用它,特别是它的功能

您可以对数据库的本地副本执行此操作,然后将其上载到生产环境