nginx 的 wordpress rewrite 和WP Super Cache rewrite规则

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

暧昧日志:

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

    比.htaccess的规则更易懂哦

  2. Mar 6th, 2010 at 09:31 | #2

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

  3. Mar 11th, 2010 at 06:22 | #3

    LOGO漏点了 你觉悟吧!

  4. Mar 18th, 2010 at 12:04 | #4

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

  5. Mar 18th, 2010 at 17:45 | #5

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

  6. Mar 20th, 2010 at 17:58 | #6

    Nginx还没怎么接触过~

  7. Mar 21st, 2010 at 08:51 | #7

    WP Super Cache rewrite一直安装不起来

  8. Mar 29th, 2010 at 12:23 | #8

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

  9. Mar 30th, 2010 at 16:55 | #9

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

  10. Jun 7th, 2010 at 13:47 | #10

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

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>