Protect Image From Other Sites

Sometimes other sites use our images, but there is no link us. Only it is fill our bandwidth limit. We can ban that users or we can show another image for that sites. You can write that image “This images can download in www.domain.com”. You have to add this codes to .htaccess

Change domain with your domain name and sucks.jpe is your image to show

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_REFERER} !^$
 RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com/.*$ [NC]
 RewriteRule .*\.(gif|jpg)$ http://www.domain.com/sucks.jpe [R,NC,L]
</ifModule>

If you want to serve a standard 403 forbidden error page

RewriteRule .*\.(gif|jpg)$ - [F,L]

If you want to add your friends sites to allow link

RewriteCond %{HTTP_REFERER} !^http://(www\.)?myfriend\.com/.*$ [NC]
Share and Enjoy:
  • StumbleUpon
  • Digg
  • TwitThis
  • FriendFeed
  • del.icio.us
  • MySpace
  • Technorati
  • Facebook
  • Google Bookmarks
  • Live

Enjoy this article?

Consider subscribing to our RSS feed!

Share us Facebook, FriendFeed, Digg

Liked by

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

No Comments

No comments yet.

Sorry, the comment form is closed at this time.