.htaccess hotlinking help required

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,
I run a large and sprawling collection of image/gallery heavy websites, and
recently moved from free server space to donated Windows space...that's
where my problems began. As I was only squatting I couldn't write the
robots.txt for the space, meaning my site's images were being called on mass
from many search engines. Without rewrting all the pages the only solution
was to move to Unix hosting, giving me the option to use .htaccess. I'm now
at the end of my tether. I've googled and found numerous sites that give the
suggested format for preventing hotlinking using .htaccess, but the format
of the scripts leaves me with one of three results. 1) The images can be
called from anywhere. 2) The images can't be called, even from my own
domains or 3) Access is denied to the entire site. My host is running RedHat
Linux 7.3, Apache 1.3.27 and I have administrator access. So where am I
going wrong?

Ideally I want image files to only be called via a link from my domain, but
I don't mind using a more specific deny list if I could be pointed at a way
to do this (preferably by domain name, rather than IP address). My current
.htaccess file, which blocks images from my domain too, looks something like

Options +FollowSymlinks
RewriteEngine on
RewriteCond % !^http://(www\.)?MYDOMAIN.co.uk(/)?.*$     [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|wav)$ - [F,NC]

Any advice would be gratefully received.

Re: .htaccess hotlinking help required

Quoted text here. Click to load it

I have now implemented a robot.txt that will prevent search engine hits, but
since the images were being made available they're now being linked to
directly from forums and chat rooms which is putting a strain on my
bandwidth. Hence needing to configure .htaccess as soon as poss.

Re: .htaccess hotlinking help required

Tigger wrote:
Quoted text here. Click to load it

This makes me suspect that you really need info about
the  *Apache* server.

Quoted text here. Click to load it

No, you should be able to deny from specific ranges of addresses.
Suggest you get "Apache Server Bible" and check chapter
"Basic Authentication".  It's been around for a while, and may
be in your local used book store.
cheers m

Re: .htaccess hotlinking help required

Quoted text here. Click to load it

Using Mod_rewrite to block hot linked images

A Users Guide to URL Rewriting with the Apache Webserver
http://www.engelschall.com/pw/apache/rewriteguide /

Module mod_rewrite: URL Rewriting Engine

Kayode Okeyode
http://www.kayodeok.co.uk/weblog /

Site Timeline