1、修改nginx配置 /usr/local/nginx/conf/host/www.411c.com.conf
添加rewrite.conf文件路径
include /usr/local/nginx/rewrite/411c_rewrite.conf
2、在/usr/local/nginx/rewrite/ 目录下添加文件411c_rewrite.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;
}
}
# 支持 WordPress 固定链接,需要 安装nginx 重写模块
3、设置WordPress:设置-固定链接,选中“数字”,保存更
转载请注明:IT运维空间 » linux » wordpress 使用固定链接的nginx rewrite规则写法
发表评论