# Multiple substitution rules per location supported?

**URL:** <https://www.ruby-forum.com/t/multiple-substitution-rules-per-location-supported/146354>\
**Category:** NGINX\
**Created:** [August 20, 2008, 9:22am UTC](https://www.ruby-forum.com/t/multiple-substitution-rules-per-location-supported/146354 "2008-08-20T09:22:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 20, 2008, 9:22am UTC](https://www.ruby-forum.com/t/multiple-substitution-rules-per-location-supported/146354/1 "2008-08-20T09:22:25Z")

</div>

Hi,  
I want to use the ngx\_http\_sub\_module to substitute the ugly urls  
in the response.  
But according to the module reference, only one substitution rule per  
location is supported.  
I want to know if there is any plan to support multiple substitute  
rules in one location?

Yours,

DeltaY

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 20, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/multiple-substitution-rules-per-location-supported/146354/2 "2008-08-20T17:15:04Z")

</div>

On Wed, Aug 20, 2008 at 03:14:44PM +0800, Delta Y. wrote:

> I want to use the ngx\_http\_sub\_module to substitute the ugly urls  
> in the response.  
> But according to the module reference, only one substitution rule per  
> location is supported.  
> I want to know if there is any plan to support multiple substitute  
> rules in one location?

The sub filter is hack. I’m not going to extend it: it’s relatively  
easy to find single match in filter, but it’s difficult to find multiple  
matches in filter. The multiple matches require to read a whole body  
before parsing.

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 20, 2008, 6:05pm UTC](https://www.ruby-forum.com/t/multiple-substitution-rules-per-location-supported/146354/3 "2008-08-20T18:05:34Z")

</div>

Hi Igor,  
Apache 2.2.8 has mod\_substitute which works like line edit.  
Is it possible to implement the line based multiple substitution in  
nginx?  
I think line based multiple substitution is enough for response body  
substitution.

BR,  
DeltaY

2008/8/20 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
