【问题标题】:Wordpress Migration from one server to another(Pages not found)Wordpress 从一台服务器迁移到另一台服务器(找不到页面)
【发布时间】:2019-06-20 13:35:47
【问题描述】:

当我将 WordPress 站点从一台服务器迁移到另一台服务器时。未找到页面,访问页面时出现错误。我已经更新了 wp-config、.htaccess 文件,还使用表格中的新站点 URL 更改了链接和 URL。

我已按照以下步骤操作:

wp-config.php

define( 'DB_NAME', 'my-db-name' );
define( 'DB_USER', 'my-db-user' );
define( 'DB_PASSWORD', 'my-db-pwd' );
define( 'DB_HOST', 'localhost' );

WordPress 设置

    Settings->
    WordPress Address (URL) - New-URL
    Site Address (URL)      - New-URL

.htacess.php

    Generate the .htacess from Permalink Settings

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /folder-name/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /folder-name/index.php [L]
</IfModule>

结束词

数据库查询

    Updated tables wp_options , wp_posts , wp_usermeta, wp_links , wp_comments

    Example:

    UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL');

在此服务器上找不到请求的 URL /New-URL/folder-name/page-name 新 URL 端口 80 处的 Apache/2.4.7 (Ubuntu) 服务器

【问题讨论】:

标签: php mysql wordpress


【解决方案1】:

如果刷新了永久链接并且您还更新了数据库,则您可能遇到了 htaccess 问题。

.htaccess 应该用双 c 拼写,并且不应该有 .php 扩展名。您还必须将内部的folder-name 更新为您正在使用的实际文件夹。

.htaccess文件:

# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /folder-name/
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /folder-name/index.php [L]
</IfModule>
# END WordPress

还可以查看这个 .htaccess 文件: https://wordpress.org/support/article/giving-wordpress-its-own-directory/#method-i-without-url-change

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多