在非根目录部署wordpress时/wp-json/wp/v2/posts这样的rest Api会访问不了
增加nginx配置(假设部署在wp文件夹下)
PHP
location /wp {
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite ^/wp/(.*)$ /wp/index.php;
}
}
登录后复制