Single RewriteRule convert please

Igor Sysoev igor at sysoev.ru
Fri Dec 3 14:09:21 MSK 2010


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

> 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\.)?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 Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list