NGINX上万能的WORDPRESS伪静态配置方案

admin 1.9K
rewrite ^ .*/files/(.*) $ / wp - includes / ms - files.php ? file = $1 last;
if (!-e $request_filename) {
    rewrite ^ . + ? (/wp-.*) $1 last; rewrite ^.+?(/.*\.php) $ $1 last;
    rewrite ^ /index.php last; }

 

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;