nginx的cofig里加上:

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

阻止对文件的访问:

location ~ /.ht {
    deny  all;
}

nginx泛域名需要在编译时加上参数: –with-http_sub_module
nginx配置: server_name www.yourdomain.com *.yourdomain.com;

nginx下WordPress的WP-SuperCache RewriteRule设置

因为空间搬家为VPS,所以报了一个The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed!的错误,重新安装一下Wp-superCache,更新下配置就行了。
nginx配置如下:

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

本文来自:http://log.medcl.net/

Related posts:

  1. 如何升级WordPress
  2. 如何在VPS中搭建一个虚拟主机
  3. TIOBE编程语言排行榜
  4. VPS Web环境的安装与配置