Results 1 to 4 of 4

Thread: hotlinking exception

  1. #1
    Wannabe Geek andywozhere's Avatar
    Join Date
    Oct 2007
    Location
    Dublin
    Posts
    258
    Post Thanks / Like

    Default hotlinking exception

    Can anyone tell me how to add an exception for hotlinking images? I have something like the below on my .ht access file:

    #RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    I was figuring if I wanted an image called image.png to be hotlinked then the code would look something like this:

    #RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC]
    RewriteCond %{REQUEST_URI} !^http://mysite.com/image.png$
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    This doesn't seem to work though. Anyone out there able to help or point me in the right direction? It's driving me nuts.
    Last edited by andywozhere; 31-10-2009 at 09:37 PM.

  2. #2
    Senior Member louie's Avatar
    Join Date
    Jan 2006
    Location
    Dublin, Ireland
    Posts
    2,423
    Post Thanks / Like

    Default

    Pass the image thorugh a php file, watermark it or check the referer & if not your website, send an image saying "Don't rob my images".
    :. Web Design & Development Web Design Ireland
    :. Search Engines Optimization Search Engines Optimization
    :. Car Parts & Accessories Car Parts
    :. Cars Ireland Cars Ireland
    :. I Have 2 Find It Directory SEF Directory

  3. #3
    Wannabe Geek andywozhere's Avatar
    Join Date
    Oct 2007
    Location
    Dublin
    Posts
    258
    Post Thanks / Like

    Default

    It's just a free icon for Google Maps from another site... I just didn't want to use up their bandwidth (or in case they moved the images), so I thought I'd put it up on my own site. I didn't think it would end up being this complicated (although that could just be me).

  4. #4
    Wannabe Geek andywozhere's Avatar
    Join Date
    Oct 2007
    Location
    Dublin
    Posts
    258
    Post Thanks / Like

    Default

    For convenience sake I just hotlinked to the source website for the moment. They seemed to be cool with it so who am I to argue. Next time I will try and pass images via php as Louie suggested (thanks)... I would like to have more control of images in case the other website goes belly up or due changes in image locations.

Similar Threads

  1. Replies: 0
    Last Post: 19-04-2009, 06:11 PM
  2. disallowing hotlinking
    By Busarus in forum Server / Technical Administration Tips and Queries
    Replies: 1
    Last Post: 25-10-2006, 11:17 PM

Visitors found this page by searching for:

hotlink exception

hotlinking exceptions

htaccess hotlink exception

htaccess hotlinking exception

htaccess hotlinking localhost

image hotlinking exception

hotlinking exception

hotlink allow exceptions

.htaccess exceptionshotlink exception htaccesshotlinking allow localhostRewriteCond with localhost hotlinkRewriteCond exceptionhtaccess hotlinking exceptionshotlinking localhost enablehotlink exceptionshtaccess hotlink exceptionshotlink .htaccess exceptionsallow hotlinking exceptionhtaccess hotlinking from localhost.htaccess exceptions for hotlink imagesrewrite engine exceptionhtaccess hotlonk localhosthotlink localhostprevent image hotlink eceptions

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •