2

I ran into a 404 not found error when trying to access a local Wordpress installation. I am migrating a working Wordpress installation from my hosting account where I set up the WordPress site. After downloading all the files into the WWW folder of my WAMP installation, I imported the SQL file from the server and imported this file to recreate the Wordpress database on my local machine.

Once completed, I tried to access the Wordpress installation by typing (((http:)))//localhost:8080/wordpress1/. I got a 404 not found error and the address at the top of my browser changed to localhost/wordpress1/. I used parenthesis to stop this editor from making the address a link

My Wp-config.php settings are: define('DB_NAME', 'wrd_okm5cj2a6c');

/** MySQL database username */ define('DB_USER', 'root');

/** MySQL database password */ define('DB_PASSWORD', '');

/** MySQL hostname */ define('DB_HOST', 'localhost');

My httpd.conf setting is: Listen 8080

When I download a copy of Wordpress from the Wordpress site, it works fine. Do you have any idea what could be wrong?

Ken

4

2 回答 2

14

a.) 您需要在 wp-config.php 中添加另外 2 行:

   define('WP_HOME','http://localhost/wordpress');
   define('WP_SITEURL','http://localhost/wordpress');

b.) 看看这个-> 一个很好的教程: http: //www.maketecheasier.com/clone-your-live-wordpress-blog-to-a-local-server/2010/06/04

c.) 如果以上一个不起作用?在您的 wordpress 网站中使用主题。如果是这样,请删除 www 文件夹中的所有 wordpress 文件并这样做。

  1. 在本教程中像这样安装 wordpress

    http://sixrevisions.com/web-development/install-wordpress-on-your-computer-using-wampserver/

  2. 在您的 localhost wordpress 登录中单独安装您的主题。

  3. 在您的托管帐户站点中,导出您的所有帖子 Tutorial-> http://codex.wordpress.org/Tools_Export_SubPanel

  4. 使用工具部分中的 wordpress 导入全部转到您的本地主机导入。您应该激活 wordpress 导入器插件。

  5. 如果您的托管 wordpress 站点中有图像,您应该在托管 cpanel 中以 zip 格式下载 wp-uploads 并将其解压缩到 localhost wordpress wp-uploads 文件夹。

于 2013-06-19T05:30:56.633 回答
1

当从一台主机迁移到另一台主机时,您必须通过 phpmyadmin 或等效工具,甚至通过 sql 命令更改 wp_options 表中的以下两个设置。要修改的条目按 option_name 列出:

  • 网址

所以对于我的 MAMP 安装,我有:

option_name    option_value
siteurl        http://localhost:8888/my_dir
home           http://localhost:8888/my_dir

您需要在我有“:8888”的地方替换您的端口号。

所以现在这是踢球者。如果您在更改条目之前尝试连接到本地站点,wordpress 将向您发送 301 重定向(永久),并且您的浏览器将缓存它。您必须清除缓存才能重置它。(刷新将不起作用)。根据您的浏览器,您可能必须刷新缓存并关闭并重新打开浏览器。(请参阅:浏览器缓存 HTTP 301 多长时间?

mysql 更新类似于: update wp_options set option_value = 'http://mydomain:1234/my_dir' where option_name = 'siteurl' OR option_name = 'home';

在哪里:

  • mydomain是您的域名,
  • my_dir是你的 wordpress 的目录,
  • 1234是你的端口
于 2013-06-19T10:37:51.303 回答