Welcome! Log In Create A New Profile

Advanced

Nginx rules based on referrer?

Posted by apasajja 
Nginx rules based on referrer?
September 02, 2010 05:41AM
I'm using wordpress with WP Super Cache. I want visitor come from google (google.com,google.co.in, etc) seeing uncached contents

...and this is my nginx rules which still not works:

[code]
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;
}
}
[/code]

Anyone can help?
Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready