How Can
I Prevent Hotlinking?
Don't you find it aggravating
when you discover that not only has someone stolen your images for her
own site, but has also not even bothered to save the images, but is hotlinking
directly to your site?
You can change the image to
something less flattering (we have full instructions to do this in our
What Is Hotlinking & What Can I Do
About It article.
You can also make a permanent
solution to prevent anyone from doing this, without having to go through
the trouble of renaming images. It is done through your .htaccess file.
You may need to check with your host, as not all hosting companies allow
their clients to change the .htaccess file, however, some will change
it if you request it.
How to change your .htaccess
file
- Save a backup of your .htaccess.
Save it as .htaccess2 for example. If you run into problems, you can
upload your backup copy to the server.
- Open the file and enter:
RewriteEngine
On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L] |
- Change example to your own
domain name in the second line above.
- Create an image called nohotlink.jpg.
This is the image that will display when someone tries to hotlink to
any of your images.
- Upload your new .htaccess
file and your image.
Don't ban hotlinkers if you
allow people to place a button or banner to your website on their own
site. They will no longer work.
|