DelphiFAQ Home Search:

How to block others from using images on my web site

 

comments1 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

Question:

How can I prevent other web sites from using images on my web server?

Answer:

You cannot really do much against them keeping a copy of the image on their server. You could apply a digital watermark to your images that is invisible to the human eye and - depending on the technology - will stay in there after basic image editing.
That way, if someone steals your image, at least you can prove that they are your images and possibly sue because of copyright infringement. (Make sure to have a disclaimer that all content is copyrighted).

You can do something against what is called 'Hot linking' - which is when the hostile web site directly links to the images on your domain. Not only do those webmasters steal your content, they even steal your bandwidth!

If you use the apache web server, then you can put the following code in the .htaccess file. This .htaccess file should be in the www root directory or in any subdirectory where you want files to be protected from hotlinking:

This solution bases on apache's mod_rewrite. It also relies on the HTTP_REFERER field, which means that a very small number of users who block the REFERER header, wil be able to see the stolen images. (This is less than 1% of all surfers according to my experience.)
In the first section the htaccess file lists a few domains that shall be allowed to retrieve images. No referrer, your own domain, 'another domain you want', altavista web site translation etc are allowed.
Make sure to replace mydomain.com in there with your actual domain name, otherwise your pages will show up without images.

The document /blank.html should be an existing document, otherwise your web server will throw an 404 error into your logs, looks bad. To save bandwidth, just create a file of length 0 bytes and save it as blank.html in your root.

RewriteEngine On
Options +FollowSymlinks

RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://([a-z0-9-]+\.)*mydomain.com/? [NC]
RewriteCond %{HTTP_REFERER}!^http://([a-z0-9-]+\.)*another-domain-you-want-to-allow.com/? [NC]
RewriteCond %{HTTP_REFERER}!^http://([a-z0-9-]+\.)*babelfish.altavista.com/? [NC]
RewriteCond %{HTTP_REFERER}!toolbar.googl [NC]
RewriteCond %{HTTP_REFERER}!/search\?q=cache: [NC]
RewriteCond %{HTTP_REFERER}!/search\?sourceid=navclient [NC]
RewriteCond %{HTTP_REFERER}!/translate_c\?hl= [NC]
RewriteRule .*\.(gif¦GIF¦jpg¦JPG)$ - [F]

ErrorDocument 403 /blank.html
Options -Indexes 

Comments:

2006-09-19, 16:40:37
apcserviceder@apcserviceder.com from Korea (R)  
rating
Google preved rodnoy!

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: