How to use location before rewrite

etrader nginx-forum at nginx.us
Tue Nov 5 01:51:53 UTC 2013


I have a set of rewrite rules as

rewrite ^/(.*) /script.php?file=$1 last;

location ~ \.php$ {
php proxy
}

but I want to make a few exceptions as

location = file1|file2|file3 {
static delivery
}

but rewrite will change any static file to php file before the latter
location.

I cannot use rewrite inside the location, as it should generate php script
before location (and I have other locations for subdirectories too).

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,244442,244442#msg-244442



More information about the nginx mailing list