nginx下wordpress rewrite规则

包含wp super cache插件的规则:

location / {
    if (-f $request_filename) {
        break;
    }
    set $supercache_file ”;
    set $supercache_uri $request_uri;
    if ($request_method = POST) {
        set $supercache_uri ”;
    }
    if ($query_string) {
        set $supercache_uri ”;
    }
    if ($http_cookie ~* “comment_author_|wordpress|wp-postpass_” ) {
        set $supercache_uri ”;
    }
    if ($supercache_uri ~ ^(.+)$) {
        set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
    }
    if (-f $document_root$supercache_file) {
        rewrite ^(.*)$ $supercache_file break;
    }
    if (!-e $request_filename) {
        rewrite . /index.php last;
    }
}

不包含的规则:

location /{
   try_files $uri $uri/ /index.php?q=$uri&$args;
}