.htaccess for just ONE image

Discussion in 'Apache' started by SoftCloud, Jul 15, 2012.

  1. #1
    Hello,

    I am just wondering how would I go about redirecting someone from an image to a page with the images on?

    For example: If someone tweets a certain image (eg; www.blah.com/images/smile.jpg) and someone clicks it, it shows that image, however instead, I want the person to be redirected to a page that's got the image on (eg; www.blah.com/gallery.php), instead of seeing just the image - if you get me?

    I only want this to work for just one image aswell.

    Any help would be grand! :)
     
    SoftCloud, Jul 15, 2012 IP
  2. khalonn

    khalonn Greenhorn

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    Not tested, try something like this in your images directory

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite\.com [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule \.(jpeg|jpg|gif|bmp|png)$ /otherdirectory/otherfile.ext [L]
     
    khalonn, Aug 9, 2012 IP