Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache

1
2010
# 作者: riku / 本文采用CC BY-NC-SA 2.5协议授权,转载请注明本文链接
#WP Permalinks rewrite
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
#WP-super-cache rewrite
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/supercache/$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;
}

作者:riku

Bio: 关注新网络、Web2.0、移动应用;Nexus S/Andorid,iPad,FreeBSD,Ubuntu 用户;伪设计师,好推墙运动。
链接:Blog - Twitter - Facebook - 此作者的更多文章
  • 作者: riku
  • Post Time: 2010/07/01 4:55:39 上午
  • In: 软件

10 Responses to Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache

Avatar

Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache | KuAPP.com - Cool Application for Ubuntu and *nix !

WordPress 3.0 WordPress 3.0

六月 30th, 2010 at 6:12 上午

[...] via: http://v.riku.me/9.html [...]

Avatar

Tweets that mention Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache | riku@VPS#> -- Topsy.com

SOAP (Simple Object Access Protocol) SOAP (Simple Object Access Protocol)

六月 30th, 2010 at 3:26 下午

[...] This post was mentioned on Twitter by Bentejuí, Nginx Tips. Nginx Tips said: Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache http://twurl.nl/uy0sir [...]

Avatar

吾吖攷 » Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache

WordPress 2.8.4 WordPress 2.8.4

七月 1st, 2010 at 12:50 上午

[...] via: http://v.riku.me/9.html [...]

Avatar

» PHP 5.3.3 发布,内置 Php-FPM 模块 Wow! Ubuntu / Ubuntu 新闻、技巧及软件!

WordPress 3.0 WordPress 3.0

七月 29th, 2010 at 3:08 上午

[...] 附:WordPress 3.0 Permalinks 和 WP-super-cache 的 Nginx rewrite 规则 [...]

Avatar

» 小内存 VPS 优化建议 (LNMP+Wordpress 环境) Wow! Ubuntu / Ubuntu 及 Linux 新闻、技巧、软件及游戏!

WordPress 3.0.3 WordPress 3.0.3

十二月 23rd, 2010 at 2:14 下午

[...] Nginx 服务器,而对于 WordPress 来说 nginx 已经完全够用了。这里是适用于 WordPress 3 的 nginx rewirte 规则,包括 Permalinks rewrite 及 WP-super-cache [...]

Avatar

gfrog

Chromium 10.0.611.0 Chromium 10.0.611.0 Ubuntu 10.10 Ubuntu 10.10

十二月 24th, 2010 at 12:40 上午

"set $wp_super_cache_file /wp-content/cache/wp_super_cache/$http_"

这行有错误,显然是复制过来的时候抄错了。

[Reply]

Google Chrome 10.0.612.1 Google Chrome 10.0.612.1 GNU/Linux GNU/Linux

riku Reply:

@gfrog, 好的,改了,多谢提醒。

[Reply]

Avatar

links for 2010-12-30 « Yesure

XML-RPC XML-RPC

十二月 31st, 2010 at 9:03 上午

[...] » Nginx rewrite rules of WordPress 3.0 Permalinks and WP-super-cache Wow! Ubuntu / Ubuntu 及 Linux... rewite rule of nginx (tags: vps nginx webdev wordpress) [...]

Avatar

小内存 VPS 优化建议 (LNMP+WordPress 环境) | Wang Jun's Blog

WordPress 3.0.1 WordPress 3.0.1

一月 8th, 2011 at 12:13 下午

[...] Nginx 服务器,而对于 WordPress 来说 nginx 已经完全够用了。这里是适用于 WordPress 3 的 nginx rewirte 规则,包括 Permalinks rewrite 及 WP-super-cache [...]

Avatar

小内存 VPS 优化建议 (LNMP+WordPress 环境) | Leafiy™/一切好玩的/新鲜的/Hear your voice-Clear your sight

WordPress 3.1.1 WordPress 3.1.1

四月 13th, 2011 at 10:48 下午

[...] Nginx 服务器,而对于 WordPress 来说 nginx 已经完全够用了。这里是适用于 WordPress 3 的 nginx rewirte 规则,包括 Permalinks rewrite 及 WP-super-cache [...]

Comment Form

top

无觅相关文章插件,快速提升流量