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?

Recommended Answers

All 2 Replies

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.

commented: GENIUS! +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.