php - 将 Wordpress 网站从 MAMP 迁移到 WAMP

标签 php mysql wordpress

我在 Mac 上使用 MAMP 在本地开发了我的 Wordpress 网站。我现在想将该网站转移到我安装了 WAMPServer 的 Windows 7 计算机上(以继续在本地开发)。

这是我试过的:

  • Exported the wordpress database to a .sql file using phpAdmin
  • Made a copy of my entire Wordpress installation (named wordpressFiles, located in the htdocs file that was installed by default with mamp)
  • Imported the wordpress to the new computer using phpAdmin
  • Copied the wordpress installation files into the www folder created by default with WAMP Server (named wordpressFiles)
  • Using phpAdmin, under wp_options I have changed my siteurl and home from http://localhost:8888/wordpressfiles to http://localhost/wordpressfiles
  • I have enabled the Apache rewrite_module and restarted servers
  • Using a text editor I added the following lines and changed the third to:

启动所有 WampServer 服务并打开 phpAdmin 后,我在项目下看到了我的 wordpress 文件夹。但是,单击它时,我收到 HTTP 500 内部错误消息。

在 wp-config.php 中,MySQL 设置是这样定义的(我想知道这里是否有问题):

define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

在我的 mac 上的 phpAdmin 中,服务器名称是 localhost,而在我的 Windows 机器上,服务器名称是 mysql wampserver。也许这是一个问题?如果是,既不更改为 define('DB_HOST', 'mysql wampserver') 也不 define('DB_HOST', '127.0.0.1') 也不 define('DB_HOST', '127.0.0.1 via TCP/IP') 修复了问题。

其他想法:这与 .htaccess 文件有什么关系吗?一些论坛和帖子告诉我暂时删除它,但事实证明我的 www 根文件夹中没有 .htaccess 文件。

最佳答案

您可以毫无顾虑地删除您的 .htacess 文件,它会在您更改永久链接设置时自行重新生成。

当您更改数据库设置时,请务必更改所有内容,因为它们可能是依赖于某些正确路径的插件或主题。

因此,不要只是在 phpMyadmin 中更改它,而是运行以下查询:

UPDATE cs_options SET option_value = replace(option_value, 'localhost:8888/paperfreeweb', 'weloveweb.co.za/paperfreeweb') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE cs_posts SET guid = replace(guid, 'localhost:8888/paperfreeweb', 'weloveweb.co.za/paperfreeweb);
UPDATE cs_posts SET post_content = replace(post_content, 'localhost:8888/paperfreeweb', 'weloveweb.co.za/paperfreeweb')

其中 localhost:8888/paperfreeweb 是旧网址,而 weloveweb.co.za/paperfreeweb 是新网址。

如果这不起作用,请将您的插件目录重命名为 plugins1 并创建一个空的插件目录,这是为了检查它是否可能是插件问题,并将您的主题文件夹移出主题目录,使其默认到 wordpress 主题,检查主题是否是您的问题。

关于php - 将 Wordpress 网站从 MAMP 迁移到 WAMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28572916/

相关文章:

mysql - 在 Wordpress 中批量删除/编辑摘录?

php - 什么 Wordpress Hook 首先触发 admin_init 或 admin_menu

php - 如何修改mysqli结果? (向结果添加一行)

php - 如何防止 PHP PDO 通过 jQuery AJAX 插入的 MySQL varchar 中的转义字符

php - Wordpress - 在 url 中重写或隐藏 wp-json

wordpress - 如何使用WPML的 'different domain per language'配置dockerized wordpress nginx?

php - 从 php 访问主题标签后的 URI 变量的最佳方法是什么?

javascript - 使用 Blade 模板无法进行验证

php - 如何删除 URL Generated Laravel 中的 “public/index.php”?

c# - 数据读取器 MYSQL 中没有当前查询