我正在将WordPress与WP Super Cache结合使用。我希望来自Google的访问者(包括所有国家/地区特定的引荐来源网址,例如google.co.in,google.co.uk等)看到未缓存的内容。
我的Nginx规则无法按照我想要的方式工作:
server {
server_name website.com;
location / {
root /var/www/html/website.com;
index index.php;
if ($http_referer ~* (www.google.com|www.google.co) ) {
rewrite . /index.php break;
}
if (-f $request_filename) {
break;
}
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;
}
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/website.com$fastcgi_script_name;
include fastcgi_params;
}
}
我应该怎么做才能实现自己的目标?