# Need help understanding Nginx Rewriting

**URL:** <https://www.ruby-forum.com/t/need-help-understanding-nginx-rewriting/174217>\
**Category:** NGINX\
**Created:** [August 22, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/need-help-understanding-nginx-rewriting/174217 "2009-08-22T19:09:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@ray](https://www.ruby-forum.com/u/ray)\
**Post date:** [August 22, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/need-help-understanding-nginx-rewriting/174217/1 "2009-08-22T19:09:14Z")

</div>

Hi guys,  
Would like to ask what IS the difference between the “last” and “break”  
flags for rewriting? It seems to me from the examples in  
[Module ngx\_http\_rewrite\_module](http://wiki.nginx.org/NginxHttpRewriteModule) that we can just use  
“break”  
for just about every situation.

Sorry if I had to bother everyone with such a simple question, but this  
email comes after reading through that page and other examples for like  
hours already 🙂

Ray.

---

<div class="post-metadata">

**Author:** ![ray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@ray](https://www.ruby-forum.com/u/ray)\
**Post date:** [August 23, 2009, 8:50am UTC](https://www.ruby-forum.com/t/need-help-understanding-nginx-rewriting/174217/2 "2009-08-23T08:50:32Z")

</div>

On Sun, Aug 23, 2009 at 12:56:13AM +0800, Ray wrote:

> Hi guys,  
> Would like to ask what IS the difference between the “last” and “break”  
> flags for rewriting? It seems to me from the examples in  
> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpRewriteModule) that we can just use “break”  
> for just about every situation.
> 
> Sorry if I had to bother everyone with such a simple question, but this  
> email comes after reading through that page and other examples for like  
> hours already 🙂

The “last” stops execution and nginx looks a new location for rewritten  
URI.  
The “break” stops execution and nginx continues processing in the same  
location.

---

<div class="post-metadata">

**Author:** ![ray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@ray](https://www.ruby-forum.com/u/ray)\
**Post date:** [August 23, 2009, 2:41pm UTC](https://www.ruby-forum.com/t/need-help-understanding-nginx-rewriting/174217/3 "2009-08-23T14:41:06Z")

</div>

I see, thanks a lot Igor!

Ray.
