Nginx Rewrite rules for WordPress MU with Wp Super Cache plugin enabled
I’ve spending my time to search how wordpressMU on nginx can support WP Super Cache plugin
By default they only giving us the rewrite rules for Apache
Default nginx rewrite rules without WP Super Cache plugin
rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
WP Super Cache plugin will not able to run with that rewrite rules. So now the question is, How can we make nginx rewrite rule to work with WP Super Cache plugin ?
Here’s my nginx config that’s running very well
if (-f $request_filename) {
break;
}if (-d $request_filename) {
break;
}rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}set $supercache_file ”;
set $supercache_uri $request_uri;if ($request_method = POST) {
set $supercache_uri ”;
}if ($query_string) {
set $supercache_uri ”;
}if ($http_cookie ~* “comment_author_|wordpress|wp-postpass_” ) {
set $supercache_uri ”;
}if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
}if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}
Congratulations that you have successfully make your nginx to work with WP Super Cache plugin
Many thanks for the tremendous idea! I would follow the blog, lot of interesting things. And my blog on science, I hope, too
Как можно связаться с автором блога для размещения постового у вас на сайте и сколько будет стоить?
you can contact me glen@lumanau.web.id