954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

A way to prevent image hotlinking?

How do I do that?
I have a few pictures and avatars I made for my friends, but I don't want them to use the images without permission. How do I protect my images?

TheChosen0ne
Newbie Poster
8 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

Most hosting services offer hotlink protection. Otherwise you need access to your document root .htaccess file

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://yoursite/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://yoursite$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yoursite/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yoursite$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]


This is from one of my sites with hotlinking protection turned on. Needless to say, replace 'yoursite' with the url of your site.

What it does is prevent any site other than yours to access the image files.

There are other codes that can be added but this is a basic one.

Dandello
Posting Whiz in Training
263 posts since May 2010
Reputation Points: 28
Solved Threads: 23
 

YOU're a genius!

TheChosen0ne
Newbie Poster
8 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You