在非根目录部署wordpress时/wp-json/wp/v2/posts这样的rest Api会访问不了

增加nginx配置(假设部署在wp文件夹下)

location /wp {  
    if (-f $request_filename/index.php) {  
        rewrite (.*) $1/index.php;  
    }  
    if (!-f $request_filename){  
        rewrite ^/wp/(.*)$ /wp/index.php;  
    }  
}

zpfei
186 声望7 粉丝

往事如风~