I have that kind of code which I wanna add to my nginx conf but unfortunately something is wrong and I don't know how to fix it...
location ^~ /folder/ {
if ($cookie_amember_nr !~* [a-zA-Z0-9]+) { #no identity
rewrite ^(.*)$ http://localhost/am3/plugins/protect/new_rewrite/login.php?v=-2,1&url=$request_uri?$args redirect;
}
set $file1 $document_root/am3/data/new_rewrite/$cookie_amember_nr-1;
set $file2 $document_root/am3/data/new_rewrite/$cookie_amember_nr-2;
if (!-f $file1 && !-f $file2) { #has not access
rewrite ^(.*)$ http://localhost/am3/plugins/protect/new_rewrite/login.php?v=-2,1&url=$request_uri?$args redirect;
}
}
and I've got an error in line with : if (!-f $file1 && !-f $file2) { #has not access
error : "[emerg] invalid condition "'!-f"
how to fix this ?
thank you for help