nginx 的 wordpress rewrite 和WP Super Cache rewrite规则

16

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

暧味日志

16 Responses

  1. bolo says:

    比.htaccess的规则更易懂哦

  2. LAONB says:

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

  3. 小宇 says:

    LOGO漏点了 你觉悟吧!

  4. 技术论坛 says:

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

  5. betaer says:

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

  6. Jutoy says:

    Nginx还没怎么接触过~

  7. Firm says:

    WP Super Cache rewrite一直安装不起来

  8. pazz7ven says:

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

  9. zwwooooo says:

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

  10. 随影 says:

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

  11. 我想问一下, 如果我的WP在子目录,例如在/home/wwwroot/blog, 这样的情况下, 应该怎样写wordpress.conf这个规则?

  12. mice says:

    留个名 先拿走了..

  13. xqiushi says:

    WP Super Cache rewrite 一直没有成功过

  14. wang says:

    因为乱码的问题 现在都还没解决 还在折腾源代码

  15. 阳朔在线 says:

    WP Super Cache 用了,mod_rewrite不大好设置.

  16. 囧啊囧 says:

    我用这个插件直接就能用是不是你一键包自动设置好了这个规则的?

Leave a Reply

© 2007-2010 猫言猫语. All rights reserved. Powered by WordPress. 15 queries in 0.094 seconds.
Proudly designed by Theme Junkie.