# What is the right place for sub\_filter?

**URL:** <https://www.ruby-forum.com/t/what-is-the-right-place-for-sub-filter/238677>\
**Category:** NGINX\
**Created:** [January 23, 2014, 7:58am UTC](https://www.ruby-forum.com/t/what-is-the-right-place-for-sub-filter/238677 "2014-01-23T07:58:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 23, 2014, 7:58am UTC](https://www.ruby-forum.com/t/what-is-the-right-place-for-sub-filter/238677/1 "2014-01-23T07:58:19Z")

</div>

Hi!

My site runs php-cgi (via fastcgi) & nginx 1.4.4.  
I need to replace www.domain refs to www1.domain ones.  
Where to place sub\_filter - in server{}, or “location /”, or “location ~  
.php$”,…?

sub\_filter www.domain www1.domain;  
sub\_filter\_types \*;

I tried all these places w/o success.

Posted at Nginx Forum:

> **[What is the right place for sub\_filter?](https://forum.nginx.org/read.php?2,246736,246736#msg-246736)**
>
> Hi! My site runs php-cgi (via fastcgi) & nginx 1.4.4. I need to replace www.domain refs to www1.domain ones. Where to place sub\_filter - in server{}, or "location /", or "location ~ .php$",..? sub\_filter www.domain...
