Welcome! Log In Create A New Profile

Advanced

Which rule is right?

June 19, 2009 05:40AM
Hi.
I setup some rules in nginx.conf, but I don't known which is right, 1 or 2? Please help me, Thanks.

1,
location ~* .*\.(jpg|jpeg|gif|png|js|ini|css|xml|ico|swf|bmp|html|htm)$ {
if ($http_user_agent ~* baidu|spider {
rewrite ^/ http://www.mydomain.com/robots.txt;
}
if ($http_referer ~* baidu|spider {
rewrite ^/ http://www.mydomain.com/robots.txt;
}
valid_referers none blocked *.mydomain.com;
if ($invalid_referer) {
rewrite ^/ http://www.mydomain.com/error.html;
access_log on;
}
expires 30d;
access_log off;
}


OR

2,
location ~* .*\.(jpg|jpeg|gif|png|js|ini|css|xml|ico|swf|bmp|html|htm)$ {
if ($http_user_agent ~* baidu|spider {
rewrite ^/ http://www.mydomain.com/robots.txt;
}
if ($http_referer ~* baidu|spider {
rewrite ^/ http://www.mydomain.com/robots.txt;
}
expires 30d;
access_log off;
}
location ~* .*\.(jpg|jpeg|gif|png|js|ini|css|xml|ico|swf|bmp|html|htm)$ {
valid_referers none blocked *.mydomain.com;
if ($invalid_referer) {
rewrite ^/ http://www.mydomain.com/error.html;
}
}
Subject Author Posted

Which rule is right?

filebackup June 19, 2009 05:40AM

Re: Which rule is right?

filebackup June 19, 2009 09:21AM

Re: Which rule is right?

filebackup June 19, 2009 09:23AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 252
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