WordPress重定向在将网站从一个服务器移动到另一个服务器后提供404


WordPress redirection gives 404 after moving site from a server to another

在将我的WordPress网站从旧的托管提供商迁移到新的VPS后,我认为我的网站运行良好,但它提供了404这是一个重定向问题,因为主页运行良好。

我的重写模式被激活,.htaccess是默认的WordPress模式,为了迁移网站,我这样进行:

  1. 我将旧文件复制到右侧vhost文件夹中
  2. 我为新服务器创建了一个mysql用户名和数据库
  3. 我用新的params更新了wp-config.php文件
  4. 我将旧数据库导入到新的空数据库

我从WordPress官方文档中复制了这个,它在其他网站上运行良好,但现在不起作用了。

我试着用谷歌搜索这个问题,但我还没有找到解决方案。

这是我的.htaccess文件(标准wordpress):

RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
AddHandler x-mapp-php5.5  .php
# BEGIN WordPress
# END WordPress

解决方案非常简单,但可能由多种因素引起

1) 您必须检查您的apachemod_rewrite是否已启用

2) 检查Allowoverride是否设置为All

3) 检查您是否有.htaccess文件

4) 检查Wordpress是否有权在上面书写(chmod 666.htaccess)

对于%postname%permalink,请检查您是否有类似的.hta访问权限:

#Begin Wordpress 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
AddHandler x-mapp-php5.5  .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>   
# END WordPress

对于我的情况,我忘记以正确的方式设置Allowoverride

相关文章: