.htaccess hotlink REGEX help please!!

Discussion in 'Site & Server Administration' started by shinycurves, Jan 3, 2008.

  1. #1
    Hi,

    I need some advice on my hotlink protection, the script I was using isn't working so i'm using a .htaccess one instead.
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?shinycurves.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google. [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ /images/hotlink.png [NC,R,L]
    Code (markup):
    I want to allow my site (obviously) as well as google images (images.google.co.uk .com .ca etc) is just google. on its own good for this?

    also, should my domain have the trailing slash?

    Thanks
     
    shinycurves, Jan 3, 2008 IP
  2. kissmyarse

    kissmyarse Peon

    Messages:
    100
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have you tested it? There's a good script at altlab.com which will try to hotlink from your server as a test. I used it when setting up mine. In the end my helpdesk did it, but i've posted a sample of my (current & working) httpd.conf below.

    Hope it helps,

    kma
     
    kissmyarse, Jan 4, 2008 IP