Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 and in whcih file to put .

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.

Thanks in advance :) cheers

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Untested.. but you'll get a better idea

if ($http_referer ~* "imgzzz.com"){ 
   rewrite ^/i/image_(\d+)/.(jpg|jpeg|gif)$ /pic/$1 last; 
} 
share|improve this answer
    
hmm k i tried this : location /i/image_ { location ~ ^/i/image_(?<IMAGE>\d+)\.(jpg|jpeg|gif)$ { valid_referers imgzzz.com www.imgzzz.com; if ($invalid_referer) { rewrite ^ /pic/$IMAGE; } } } –  Ayaz Malik Dec 3 '10 at 13:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.