nginx 的 wordpress rewrite 和WP Super Cache rewrite规则
March 4th, 2010 | Categories: WordPress | Tags: Nginx, wordpress rewrite, WP Super Cache, 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;
}
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;
}
}
{
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:

比.htaccess的规则更易懂哦
NGINX的规则要自己来写啊,等用的时候再过来看你的教程。
一不小心看到了”魔兽世界各种族裸体(女性内衣透明化)补丁下载“(¯﹃¯)
LOGO漏点了 你觉悟吧!
将http://www.js4j.com/index.html
301重定向到
http://www.js4j.com
能实现吗!??
暂时还未曾搭建LNMP环境 前排留名先╮(╯_╰)╭
Nginx还没怎么接触过~
WP Super Cache rewrite一直安装不起来
我安装成功了 但是杯具发生了 点击分类打不开 点击文章打不开 还500了
其实我是顺便来看header图片的……
我那个服务器 写的 伪静态都不稳定 ! 不晓得咋回事!