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.

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
add comment

1 Answer 1

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
add comment

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.