Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Oct 262011
 

The difference between last and break used in Nginx URL rewrite

Answer:

When you rewrite URL using the Nginx's rewrite directive, you might be confused that what are the exact difference between last and break?

From the official site: http://wiki.nginx.org/HttpRewriteModule#rewrite

last - completes processing of rewrite directives, after which searches for corresponding URI and location
break - completes processing of rewrite directives and breakes location lookup cycle by not doing any location lookup and internal jump at all

So: both directives will end the rewrite cycle, but break will not do any location lookup and internal jump afterward.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>