CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Stopping offsite linking to images

 



countryfan
stranger

May 19, 2001, 8:44 PM

Post #1 of 3 (1094 views)
Stopping offsite linking to images Can't Post

Hi. I run a small free web hosting service, and am having problems with people storing their images on my server, and then linking to them from other websites (thus using my bandwidth and costing me money!). Is there any way that I can stop people from doing this?

I know that I could write a script in Perl, but the only way that I can think of doing this is having all the images behind a script ie. instead of the location of each image being shown as www.mydomain.com/image.jpg then it would be something like www.mydomain.com/cgi-bin/imageprotector.cgi?image.jpg. However, this isn't very practical for my purposes.

I've noticed that with the larger free web hosting providers such as GeoCities, if you try to link to images stored on their server from offsite, you will be shown an "error" image in their place. Does anyone know how they do this? Is it something that can be done on the server level? (I'm running my site off a dedicated Unix server; is there anything I can set on the server to stop people linking to the images on there?)

Any suggestions or help would be very much appreciated!



vandriel
Deleted

May 21, 2001, 4:47 AM

Post #2 of 3 (1083 views)
Re: Stopping offsite linking to images [In reply to] Can't Post

You cannot solve this with a script, but you have to configure this in your .httpd config, by routing all requests for imagefiles to a .sh script.
Such as :
if (extension=gif/jpg) {check referer}
if (referer ne your.domainname) {show error image}




widexl
Novice

May 21, 2001, 8:26 AM

Post #3 of 3 (1076 views)
Re: Stopping offsite linking to images [In reply to] Can't Post

Try this needed mod_rewrite,
I use it for linking images.
You can try to link my images
http://widexl.com/images

Protecting your images from linking

For this you need mod_rewrite have installed on your webserver.
Put a file named .htaccess in the directory where you have the images located.

AuthUserFile /dev/null
AuthGroupFile /dev/null

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://www.widexl.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://ma.widexl.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://members.widexl.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://widexl.com.* [NC]
RewriteCond %{HTTP_REFERER} !^http://212.204.218.80.* [NC]

RewriteRule /* http://widexl.com/index.html [R,L]

By the RewriteCond change the web address name for who are allowed to use your images.
By the RewriteRule change the web address name where to send the ones who are linking to.

You need to write for every web address a new line.
Remember: http://widexl.com is not the same like http://www.widexl.com



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives