将 Wordpress 网站从 MAMP 迁移到 WAMP
Moving Wordpress site from MAMP to WAMP
我在 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:
- define('WP_HOME', 'http://localhost/wordpress');
- define('WP_SITEURL','http://localhost/wordpress');
- define('DB_HOST', '127.0.0.1');
启动所有 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 machine 上,服务器名称是 mysql wampserver。也许这是一个问题?如果是,既不更改为 define('DB_HOST', 'mysql wampserver') 也不 define('DB_HOST', '127.0.0.1') 也不 define('DB_HOST', '127.0.0.1 通过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 是旧的 url 而 weloveweb.co.za/paperfreeweb 是新的 url.
如果这不起作用,请将您的插件目录重命名为 plugins1 并创建一个空的插件目录,这是为了检查是否可能是插件问题,并将您的主题文件夹移出主题目录,以便它默认为 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:
- define('WP_HOME', 'http://localhost/wordpress');
- define('WP_SITEURL','http://localhost/wordpress');
- define('DB_HOST', '127.0.0.1');
启动所有 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 machine 上,服务器名称是 mysql wampserver。也许这是一个问题?如果是,既不更改为 define('DB_HOST', 'mysql wampserver') 也不 define('DB_HOST', '127.0.0.1') 也不 define('DB_HOST', '127.0.0.1 通过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 是旧的 url 而 weloveweb.co.za/paperfreeweb 是新的 url.
如果这不起作用,请将您的插件目录重命名为 plugins1 并创建一个空的插件目录,这是为了检查是否可能是插件问题,并将您的主题文件夹移出主题目录,以便它默认为 wordpress 主题,以检查该主题是否是您的问题。