从一台服务器到另一台服务器的Wordpress迁移(找不到页面)

时间:2019-06-20 13:35:47

标签: php mysql wordpress

当我将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>

END Word

数据库查询

    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 /文件夹名称/页面名称     新URL端口80上的Apache / 2.4.7(Ubuntu)服务器

1 个答案:

答案 0 :(得分:0)

如果刷新了永久链接,并且您也更新了数据库,则可能是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