# Single RewriteRule convert please

**URL:** <https://www.ruby-forum.com/t/single-rewriterule-convert-please/200038>\
**Category:** NGINX\
**Created:** [December 3, 2010, 11:53am UTC](https://www.ruby-forum.com/t/single-rewriterule-convert-please/200038 "2010-12-03T11:53:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 3, 2010, 11:53am UTC](https://www.ruby-forum.com/t/single-rewriterule-convert-please/200038/1 "2010-12-03T11:53:58Z")

</div>

0 down vote favorite

hello everyone, i just installed nginx up and running for serving static  
content on my site. it works great but the apache rewrite rule about  
images (ofcourse) stoped working.

and i don’t have an idea how to convert .

This is what i was using on apache :

RewriteCond %{HTTP\_REFERER} !^http://(www.)?[999策略白菜网站 - 999策略白菜论坛网](http://imgzzz.com/.*$) [NC]  
RewriteRule i/image\_(\d+).(jpg|jpeg|gif) pic/$1 [L]

Its purpose is to redirect directly accessed images to the image page  
instead. Helps is appreciated

Thanks in advance 🙂  
cheers

Posted at Nginx Forum:

> **[Single RewriteRule convert please](https://forum.nginx.org/read.php?2,155260,155260#msg-155260)**
>
> 0 down vote favorite hello everyone, i just installed nginx up and running for serving static content on my site. it works great but the apache rewrite rule about images (ofcourse) stoped working. and i don't have an idea how to convert . This i

---

<div class="post-metadata">

**Author:** ![wickedsunny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f9ae1b/32.png) [@wickedsunny](https://www.ruby-forum.com/u/wickedsunny)\
**Post date:** [December 3, 2010, 12:10pm UTC](https://www.ruby-forum.com/t/single-rewriterule-convert-please/200038/2 "2010-12-03T12:10:18Z")

</div>

On Fri, Dec 03, 2010 at 05:52:51AM -0500, wickedsunny wrote:

> RewriteCond %{HTTP\_REFERER} !^http://(www.)?[imgzzz.com/.\*$](http://imgzzz.com/.*$) [NC]  
> RewriteRule i/image\_(\d+).(jpg|jpeg|gif) pic/$1 [L]
> 
> Its purpose is to redirect directly accessed images to the image page  
> instead. Helps is appreciated

This is configuraiton for 0.8.53:

location /i/image\_ {

```
location ~ ^/i/image_(?<IMAGE>\d+)\.(jpg|jpeg|gif)$ {
    valid_referers imgzzz.com www.imgzzz.com;

    if ($invalid_referer) {
        rewrite ^ /pic/$IMAGE;
    }
}

```

}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![wickedsunny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f9ae1b/32.png) [@wickedsunny](https://www.ruby-forum.com/u/wickedsunny)\
**Post date:** [December 3, 2010, 12:24pm UTC](https://www.ruby-forum.com/t/single-rewriterule-convert-please/200038/3 "2010-12-03T12:24:44Z")

</div>

Thank u so much let me give it a try . and will get back to u . cheers

Posted at Nginx Forum:

> **[Re: Single RewriteRule convert please](https://forum.nginx.org/read.php?2,155260,155265#msg-155265)**
>
> 0 down vote favorite hello everyone, i just installed nginx up and running for serving static content on my site. it works great but the apache rewrite rule about images (ofcourse) stoped working. and i don't have an idea how to convert . This i
