简体   繁体   English

在本地服务器上使用Wordpress网站时出现问题

[英]Problems working with a Wordpress site on a local server

I'm trying to download a large Wordpress site and work on it locally. 我正在尝试下载大型Wordpress网站并在本地进行处理。 I exported/imported the SQL successfully using PHPMyAdmin w/ XAMPP, and changed the wp-config.php file to match my MySQL login information and I'm no longer getting "Error establishing a database connection". 我使用带有XAMPP的PHPMyAdmin成功地导出/导入了SQL,并更改了wp-config.php文件以匹配我的MySQL登录信息,并且不再遇到“建立数据库连接时出错”的信息。 As far as I know, the schemas and imported information should all be good to go, but I am getting a 404 Error on the main page. 据我所知,模式和导入的信息都应该很好,但是我在主页上看到404错误。 Is there anywhere else I might need to update the database settings? 我可能还需要更新数据库设置吗?

Any help would be much appreciated. 任何帮助将非常感激。

you will need to update your DB like so : 您将需要像这样更新数据库:

Update new location > 更新新位置>

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';

Fix URLs and Post slugs > 修复URL和帖子标签>

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

Then fix internal links > 然后修复内部链接>

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

In your case http://www.new-domain.com would be http://localhost or http://localhost/your_wp_install_folder/ 在您的情况下, http://localhost http://www.new-domain.com将是http://localhosthttp://localhost/your_wp_install_folder/

After running this , just to make sure , go to your DB and check the options table for the siteurl and home options, and see that they really do point to the right place ... 运行此命令后,请确保进入数据库并检查options表中的siteurlhome选项,并确认它们确实指向正确的位置...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM