romgut
asked on
Prevent other sites from displaying my images
I have a lot of images on my site and I've discovered to people are linking directly to them from their websites. This has become a problem because they are using up my bandwidth. Is there someway of setting up a directory where I can put all my images so that they will only be displayed if they are accessed from my site? I was told that there may be an .htaccess directive that can do this. Any suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This looks interesting. I'll have to try and get my hosting service to install the module so I can try it.
I'd be interested in hearing if anyone has alternative solutions.
I'd be interested in hearing if anyone has alternative solutions.
ASKER
This looks interesting. I'll have to try and get my hosting service to install the module so I can try it.
I'd be interested in hearing if anyone has alternative solutions.
I'd be interested in hearing if anyone has alternative solutions.
ASKER
The info from the link you provided worked. Thanks.
http://www.chaosreigns.com/adventures/entry.php?date=2001-11-28&num=1
http://www.chaosreigns.com/adventures/entry.php?date=2001-11-28&num=1
no prob.
http://www.bignosebird.com/apache/a16.shtml
--- copied from the page, hope this would solve your problem.
NOTE: In order to use this feature of the Apache Server, you must make sure
that the server was installed with the mod_rewrite.o file. This is done by adding
the line to the Configuration file before compiling the server.
AddModule modules/standard/mod_rewri
Create a .htaccess file in the image directory you wish to protect.
This set of rules basically looks at the domain name provided by
the HTTP_REFERRER (from the beginning) without regard to upper
or lower case. (NC means No Case). The RewriteRule for gif and
jpg is to report the file as gone. Do not use F for forbidden if you
are using ErrorDocument redirects.
You can also do this to protect other types of files such as MIDI
files by changing the gif to mid. Of course, be sure to change
bignosebird.com to whatever your domain happens to be!
Note: This does not prevent people from right-clicking and saving
images on your pages.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://bignosebird.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.bignosebird.com/.*$ [NC]
RewriteRule .*\.gif$ - [L]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://bignosebird.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.bignosebird.com/.*$ [NC]
RewriteRule .*\.jpg$ - [L]
Some interesting docs:
http://cybernut.com/guides/apconf.html#access_link