从本地计算机在一台计算机上运行Wordpress网站到另一台计算机

时间:2019-12-17 05:36:40

标签: php wordpress xampp wamp

我有一台计算机上有一个Wordpress网站。现在,我想在本地另一台计算机(xampp或wamp)中运行该站点。 为此,我用数据库SQL文件压缩了该文件夹中的所有文件,并将该压缩文件解压缩到另一个PC xampp htdocs文件夹中。创建数据库并将SQL文件导入数据库。

但是在运行网站时会出现错误

  

未找到   在此服务器上找不到请求的URL /Ullash/builders/index.php。

我在wp-config.php

中添加了以下代码
define( 'WP_HOME', 'http://localhost/Projects/new-ullash/builders' );
define( 'WP_SITEURL', 'http://localhost/Projects/new-ullash/builders' );

但错误仍然相同。

有人帮助吗?预先感谢

2 个答案:

答案 0 :(得分:1)

我有解决方案。 在wp-config.php

中添加以下代码
define( 'WP_HOME', 'site url' ); // site url sample : http://localhost/Projects/new-ullash/builders
define( 'WP_SITEURL', 'site url' ); // site url sample : http://localhost/Projects/new-ullash/builders

还要更改.htaccess文件中的项目路径

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Projects/new-ullash/builders/  // change project path here
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Projects/new-ullash/builders/index.php [L] // change project path here
</IfModule>

答案 1 :(得分:0)

如果您想以更快,更干净的方式执行所有操作,请在一个迁移中安装所有功能
https://wordpress.org/plugins/all-in-one-wp-migration/