2

My config

    rewrite /silosy /produktsiya/silosy last;

    location /go/ {
        rewrite /go/http\:/(.*) http://$1 permanent;
    }

    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }

Now rewrite for "/go" and "/silosy" doesn't work because: "if (!-e $request_filename)" is using. How can I add location restriction like this:

location [not (go|silosy)] {
    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }
}

How will "not" be looking in nginx location?

2 Answers 2

2

I don't know how will looks "not" in location, But I found solution:

    rewrite ^/silosy /produktsiya/silosy permanent;
    rewrite ^/go/(.*) http://$1 permanent;

    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }
1

Put your if (!-e $request_filename) into location / block. It is for the unmatched.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .