Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hiz
I have already asked this question few days back but havent received any answer yet.so i am going to delete that and re ask here.

I have this .htaccess rewrite rule which redirects/rewrites directly accessed images of a certain folder to its original page.

RewriteCond %{HTTP_REFERER} !^http://(www\.)?imgzzz.com/.*$ [NC]
RewriteRule i/image_(\d+)\.(jpg|jpeg|gif) pic/$1 [L]

But it also stops the hotlinking. Can i modify this code that it wil let users hotlink the image but will send directly opened images to image page like the above code is doing ?

Already tried removing the first line. it stops the image to display on main pages.

and doing this :

RewriteCond %{HTTP_REFERER} ^.*$
RewriteRule i/image_(\d+)\.(jpg|jpeg|gif) pic/$1 [L]

If its not possible to keep the redirect to image page and allow hotlinking then is it possible to allow pinterest in my site to hotlink image so images can be submitted to pinterest.

share|improve this question

Try the following:

RewriteCond %{HTTP_REFERER} !^$
RewriteRule i/image_(\d+)\.(jpg|jpeg|gif) pic/$1 [L]

The !^$ means not blank, so the image is being accessed via a page link, from any site:

share|improve this answer
    
Hello, by doing that image stops showing up on original image pages e.g imgzzz.com/pic/1356988098 – Ayaz Malik Jan 18 '13 at 13:06
    
What appears in you /var/log/httpd/access*log for the failed requests? – arober11 Jan 18 '13 at 15:49
    
i am not sure about that i would have to ask my hosting guy to take a look at it – Ayaz Malik Jan 18 '13 at 15:56

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.