当前位置: 首页 > 后端技术 > PHP

wordpress非根目录部署nginx关键配置

时间:2023-03-29 15:03:25 PHP

在非根目录下部署wordpress时,/wp-json/wp/v2/posts等restAPI将无法访问添加nginx配置(假设部署在wp文件夹)location/wp{if(-f$request_filename/index.php){重写(.*)$1/index.php;}if(!-f$request_filename){重写^/wp/(.*)$/wp/index.php;}}