How to use location before rewrite

Francis Daly francis at daoine.org
Tue Nov 5 07:34:37 UTC 2013


On Mon, Nov 04, 2013 at 08:51:53PM -0500, etrader wrote:

Hi there,

the answer to the question in the Subject: line is "you don't".

> 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
> }

Depending on the full plan, perhaps either put your rewrites inside
"location / {}"; or add earlier rewrites of the form

  rewrite ^(/file1)$ $1 last;

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list