.htaccess file to block deep linking of images

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waterwheel
    Senior Member
    • Oct 2004
    • 257
    • 3.6.x

    .htaccess file to block deep linking of images

    I've tried:

    Code:
    <directory /www/html/actuarial_discussion_forum/images>
    <files avatar.php>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://actuarialoutpost.com     [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.actuarialoutpost.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://actuary.ca     [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.actuary.ca [NC]
    RewriteRule .*\.(gif|GIF|jpg|JPG|png|PNG|jpeg|JPEG)$ http://www.actuarialoutpost.com/deeplinkimg1.gif [R]
    
    RewriteRule avatar.php               [F]
    </files>
    <files attachment.php>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://actuarialoutpost.com     [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.actuarialoutpost.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://actuary.ca     [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.actuary.ca [NC]
    RewriteRule .*\.(gif|GIF|jpg|JPG|png|PNG|jpeg|JPEG)$ http://www.actuarialoutpost.com/deeplinkimg1.gif [R]
    RewriteRule attachment.php               [F]
    </files>
    </directory>
    Didn't work.

    I tried:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    
    RewriteCond %{HTTP_REFERER} !^http://www.actuarialoutpost.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://actuarialoutpost.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.actuary.ca/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://actuary.ca/.*$ [NC]
    RewriteRule \.(gif|jpg|png|jpeg)$ http://www.actuarialoutpost.com/deeplinkimg1.gif [R,L]
    No dice.

    And I've tried a few other things. . . .

    Here's the big question. I only found something on this forum for vB 2.something, and nothing in this forum for 3.6.

    What code works for blocking images from other sites? What do you guys use, on vBulletin.com? Please cut and paste the .htaccess file and then kindly tell us which directory to put it in, please. Isn't this a FAQ?

    TIA,

    WW

    Also, can we get a sticky that tells people to make their thread titles more descriptive? It seems that every time I search for something on this forum, all my results are "I have a question" or "some help" or something like that.

    Where is the forum etiquette? I have no idea how a forum filled with members who run forums can't put together a coherent thread title. wtf?!?
    "Oh, so they have internet on computers now!" --Homer.

  • EyeCraveDVD.com
    Member
    • May 2001
    • 32
    • 3.5.x

    #2
    I'm also interested blocking attachment.php access from anyone other than my site or my subdomains. Not specifically registered users because we use it currently for some of our images for articles on our mainpage.
    Last edited by EyeCraveDVD.com; Thu 22 Mar '07, 8:06pm.
    Shane
    www.eyecravedvd.com

    Comment

    • eclectica
      Senior Member
      • Sep 2003
      • 334
      • 3.6.x

      #3
      If I wanted to block other sites from using "my" images I would enable Hotlink Protection in cPanel. Blocking attachment viewing can be set in the usergroup permissions of the unregistered guests.

      Comment

      • steven s
        Senior Member
        • Jul 2004
        • 3722
        • 3.8.x

        #4
        Let's revive this thread.
        I too need to block people from hotlinking image attachments.

        I do not want to block attachments to those visiting my site as a guest, only other sites.

        Below doesn't seem to work.
        HTML Code:
        <Files attachment.php>
        Options +FollowSymlinks 
        RewriteEngine on
        RewriteCond %{HTTP_REFERER} !^$
        RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com(/)?.*$ [NC]
        RewriteCond %{HTTP_REFERER} !^http://(www\.)?myisp(/)?.*$ [NC]  
        RewriteRule attachment.php               [F]
        </Files>
        It wouldn't be as bad if I can add a watermark to attachments. Can I?
        Last edited by steven s; Sat 28 Jun '08, 7:10am.
        ...steven
        www.318ti.org (vB3.8) | www.nccbmwcca.org (vB4.2)
        bmwcca.org/forum | m135i.net
        "I tried to clean this up but this thread is beyond redemption." - Steve Machol

        Comment

        • peterska2
          Senior Member
          • Oct 2003
          • 8869
          • 3.7.x

          #5
          Sorry, there is no function to do this. This requires modifying the code. We cannot officially support code modifications or forums running modified code, however you can try searching or asking for help with this over at www.vbulletin.org.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...