我想在我的 MAMP 服务器上本地托管一个 wordpress 网站。这是我遵循的程序:1. 在网站上安装复制器插件并创建网站包。2. 从包中下载安装程序和存档文件以及 installer.php 文件。3. 使用 MAMP 服务器在 phpmyadmin 中创建数据库。4. 将存档文件和安装程序移动到 MAMP/Applications/htdocs 文件夹中。5. 尝试打开 localhost/foldername/installer.php。
执行完所有这些步骤后,出现错误,无法在本地运行。wordpress 已安装在本地主机上。建议解决此问题。
答案1
您可以通过另一种方式将网站复制到本地主机,而无需使用任何额外的插件。
脚步:
1. Export the database using phpmyadmin interface and save that as a .sql file.
2. Extract wordpress.zip file downloaded from wordpress.org to MAMP/htdocs.
3. Copy wp-content folder and wp_config.php from old site and Paste it under new wordpress folder.(Replace the files)
4. Create a database in new host with same database name and import the .sql file.
5. Goto localhost:8888 in your browser. (Before this, you need to change document root to this wordpress folder by using preferences in MAMP) You will get your site.
笔记:
If you find any old urls in your site, (Broken urls to media items) You can do a search and replace in database using the following sql queries. Do this one by one inside your wordpress database.
UPDATE wp_posts SET guid = replace(guid, 'http://old-site','http://new-site');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old-site', 'new-site');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'old-site','new-site');