在非根目录下部署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;}}

在非根目录下部署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;}}