nginx环境下访问有时访问wordpress后台会直接返回错误。仔细发现路径少了wp-admin,解决方法很简单在/usr/local/nginx/conf/wordpress.conf文件进行修改

location / {
index index.html 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;

然后重启nginx环境即可。

相关文章:

  • 2021-05-18
  • 2021-07-31
  • 2021-10-02
  • 2021-08-17
  • 2022-12-23
  • 2021-05-06
  • 2021-10-12
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-01-02
  • 2022-02-18
  • 2021-07-18
  • 2022-12-23
相关资源
相似解决方案