Results 1 to 10 of 10
  1. #1

    Hotlink Prevention!

    Hello! I have a bit of a problem that I am sure is heard rather often.. but here's my problem!

    Well, I have an image gallery site and hotlinking is a major big problem for me. I ask people not to do it on every single page, yet some opt to do otherwise.

    I've tried using the .htaccess file and I've changed every dang parameter possible, and well, what happens is that it won't let me hotlink to my own images.

    It's like this. The webpage is in one directory, and the images are in another, and whenever I use the .htaccess file, the images I'm trying to display on my own page won't come up.

    It's like this: http://www.site.com/site/folder/page.php
    On this page, I'm trying to access the images from here:

    http://www.site.com/site/folder/subfolder

    I've tried several versions of the .htaccess file, and it won't let the images come up on my site when I use it!

    Does anyone know the exact code I can use to prevent people from hotlinking to my images, but still allowing me to hotlink mine?

    Thank you very much for your help! *Bowbow*

  2. #2
    ....please? *Sad*

  3. #3
    Join Date
    Jan 2004
    Posts
    67
    did you mean you have your images in folder:
    yourdomain.com/images/

    and you are trying to display images on webpages that are in:
    yourdomain.com/dir/subdir/page.html?

  4. #4
    Join Date
    Jan 2003
    Location
    Houston, TX - Originally from UK
    Posts
    707
    Rose, try this:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$     [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ - [F,NC]
    Just change yourdomain.com to...well, your domain!

    That should work, as all it does is stop hotlinking from domains other than yours
    Kinkamono Internet Services - The Internet. Done Right.
    Dive In...

  5. #5
    Join Date
    Jul 2002
    Location
    Detroit
    Posts
    186
    there's a built in hotlink protection in Cpanel if you have it. it allows you to specify certain domains that are allowed to hotlink

  6. #6
    Join Date
    Sep 2002
    Location
    London/Edinburgh
    Posts
    1,131
    If you dont have cPanel try:
    http://www.hotscripts.com/PHP/Script...ams/index.html

    Might find something to help you there.

    Regards
    Thomas Currie
    Europhase UK Limited - XEN/OpenVZ UK/US Virtual Private Servers | R1Soft Backups for Web Hosts
    Custom R1Soft Backups | UK/US Web Hosting | UK/US Virtual Private Servers
    99.9% Uptime SLA | Non Overloaded Service | Guaranteed Ram / Resources
    Company: SC345142 VAT: GB-947754180 Tel: 0870 4710 895

  7. #7
    Join Date
    Apr 2002
    Location
    Southern Maryland
    Posts
    246
    I have a tutorial here for hotlinking...if all else fails.
    Sara

    Sara Nelson Photography Preserving your moments since 1973.

  8. #8
    I had that problem too. I use the hotlink protection on Cpanel and sometimes I replace the hotlinked image with one that says "guilty of hotlinking"...

  9. #9
    Join Date
    Jan 2004
    Location
    Washington, DC
    Posts
    450
    ModRewrite is a very, very useful tool!
    Christian Dawson Exectuive Director and Co-Founder, i2Coalition
    The i2Coalition is comprised of small to medium cloud providers, data centers, registrars, registries and other foundational Internet enterprises. Join today!
    Follow us on Twitter @i2coalition or checkout our forum!

  10. #10
    Join Date
    Jul 2003
    Posts
    533
    i belive if some one like me running Norton internet security will be blocked from your images because Norton stops your server from seeing my refer or am i wrong ? because i tried this with some client site.

    any comments ?

Posting Permissions

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