nginx下wordpress固定链接参数配置

由于Nginx不支持Apache的.htaccess文件,要实现持久连接静态化,我们必须手工配置Nginx的文件。首先找到Nginx的配置文件, 默认编译后的配置文件在/usr/local/nginx/conf/nginx.conf加入如下配置语句:

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;
}
}

声明: 本文采用 BY-NC-SA 协议进行授权 | helloyi
转载请注明转自《nginx下wordpress固定链接参数配置

给我留言

留言没头像?这里教你设置头像!