最新消息:时间抓起来说是金子,抓不住就是流水。

wordpress 使用固定链接的nginx rewrite规则写法

LINUX技术 老子黑牵翻 4573浏览 0评论

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:设置-固定链接,选中“数字”,保存更

转载请注明:LINUX服务器运维架构技术分享 » wordpress 使用固定链接的nginx rewrite规则写法

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址