Today's Most Popular

Recent Comments

Incoming Search Referrals

Posts Recently Commented

Real Estate Investing and Finance

News

Politics

Linux How To

The Tech Blog




How to Block Remote Image Linking without Using .htaccess

Pesky myspace.com users remote linking to images on your site in their sigs? Using .htaccess seems to be the default method most people use to try and block these requests. But, this may not be the most effective method anymore as browsers like Firefox may circumvent this. Sooo, how do you block remote image linking without using .htaccess? Well, I just came across this little tutorial on blocking remote image linking in httpd.conf. It is successful at blocking the image requests from myspace returning 404, but the request still makes it to the web server. But, at least they are not going to smoke your bandwidth by ripping the images.

Here is how I did it. Substitute your domain for golod.com suckas:

  1. Make sure you have the mod_setenvif.c module for your version of Apache. It was installed by default on my Apache 1.3 install.
  2. Place the following code, substituting your domain in place of golod.com. You can also add other allowed hosts aside from your localhost or the domain of the website…check the link to the website above. Put this code between the tags in httpd.conf:
    #Block Remote Linking
    SetEnvIfNoCase Referer localhost LOCAL_HOST
    SetEnvIfNoCase Referer www.golod.com LOCAL_REFERER
    
    Order deny,allow
    Deny from all
    Allow from env=LOCAL_REFERER
    Allow from env=LOCAL_HOST
    
    Order deny,allow
    Deny from all
    Allow from env=LOCAL_REFERER
    Allow from env=LOCAL_HOST
    
    Order deny,allow
    Deny from all
    Allow from env=LOCAL_REFERER
    Allow from env=LOCAL_HOST
  3. Now you just have to restart Apache and you will be blocking all of the remote image leeches.

tags: apache, images, myspace, theft, webmaster, website

One Response to “How to Block Remote Image Linking without Using .htaccess”

  1. Grindlay (1 comments.) Says:

    How come the lines:
    Order deny,allow
    Deny from all
    Allow from env=LOCAL_REFERER
    Allow from env=LOCAL_HOST
    are duplicated ?
    Seems to work with just the one entry.

Leave a Reply