wordpress新装,就出现这个报错,大概率是没有设置nginx静态化,可以参考如下配置,放到nginx.conf的server段里:
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# 阻止xmlrpc.php 被扫描
location ~* ^/xmlrpc.php$ {
return 403;
}
固定链接配置: