nginx 的 wordpress rewrite 和WP Super Cache rewrite规则

March 4th, 2010 | Categories: WordPress | Tags: , , ,

wordpress.conf

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

supercache.conf

location /
{
autoindex off;
gzip_static on;

set $wp_super_cache_file '';
set $wp_super_cache_uri $request_uri;

if ( $request_method = POST )
{
set $wp_super_cache_uri '';
}

if ( $query_string )
{
set $wp_super_cache_uri '';
}

if ( $http_cookie ~* "comment_author_|wordpress|wp-postpass_" )
{
set $wp_super_cache_uri '';
}

if ( $wp_super_cache_uri ~ ^(.+)$ )
{
set $wp_super_cache_file /wp-content/cache/wp_super_cache/$http_host/$1index.html;
}

if ( -f $document_root$wp_super_cache_file )
{
rewrite ^(.*)$ $wp_super_cache_file break;
}

if (-f $request_filename)
{
expires 30d;
break;
}

if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
}

Related posts:

  1. 推荐WordPress插件 - WP Widget Cache
  2. 最有效的压缩CSS样式表和js脚本
  3. WordPress 无法使用自定义链接、页面提示Forbidden两个问题的解决办法
  4. WordPress 2.6将新增文章对比功能
  5. WordPress 插件推荐:WP-T-WAP
  1. March 4th, 2010 at 21:19

    比.htaccess的规则更易懂哦

  2. March 6th, 2010 at 09:31

    NGINX的规则要自己来写啊,等用的时候再过来看你的教程。
    一不小心看到了”魔兽世界各种族裸体(女性内衣透明化)补丁下载“(¯﹃¯)

  3. March 11th, 2010 at 06:22

    LOGO漏点了 你觉悟吧!

  4. March 18th, 2010 at 12:04

    将http://www.js4j.com/index.html
    301重定向到
    http://www.js4j.com
    能实现吗!??

  5. March 18th, 2010 at 17:45

    暂时还未曾搭建LNMP环境 前排留名先╮(╯_╰)╭

  6. March 20th, 2010 at 17:58

    Nginx还没怎么接触过~

  7. March 21st, 2010 at 08:51

    WP Super Cache rewrite一直安装不起来

  8. March 29th, 2010 at 12:23

    我安装成功了 但是杯具发生了 点击分类打不开 点击文章打不开 还500了

  9. March 30th, 2010 at 16:55

    其实我是顺便来看header图片的……

  10. June 7th, 2010 at 13:47

    我那个服务器 写的 伪静态都不稳定 ! 不晓得咋回事!