[英]WordPress redirection gives 404 after moving site from a server to another
After migrating my WordPress sites from my old hosting provider to my new VPS thought my sites works fine but it was giving 404 not found everywhere it's a redirection issue because the home page is working fine. 将我的WordPress网站从旧的托管服务提供商迁移到新的VPS后,我认为我的网站可以正常工作,但是由于主页工作正常,它在所有地方都找不到404,这是一个重定向问题。
My rewrite mod is activated, the .htaccess
is the default WordPress one, for migrating the site I proceed like this: 我的重写模块已激活,
.htaccess
是默认的WordPress之一,要迁移该网站,请按以下步骤操作:
I copied this from WordPress official documentation and it worked fine for other sites but now it's not working. 我从WordPress官方文档中复制了此文件,它在其他站点上也可以正常工作,但现在不起作用。
Tried to google the issue but I haven't got the solution. 试图谷歌的问题,但我没有解决方案。
This is my .htaccess
file (standard 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
The solution is so simple but can be caused by various factors 解决方案是如此简单,但可能由多种因素引起
1) You must check if your apache mod_rewrite is enabled 1)您必须检查您的apache mod_rewrite是否已启用
2) Check if Allowoverride is set to All 2)检查Allowoverride是否设置为All
3) Check if you have a .htaccess file 3)检查您是否有.htaccess文件
4) Check if Wordpress have the right to write on it (chmod 666 .htaccess) 4)检查Wordpress是否有权在上面写(chmod 666 .htaccess)
for %postname% permalink check if you have a similar .htaccess to this one : 为%postname%永久链接检查您是否具有与此类似的.htaccess:
#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
For my case i forgot to set Allowoverride in a correct way 就我而言,我忘记以正确的方式设置Allowoverride
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.