live chat software for live support and live help Online chat software for website

Live chat software

Browser based operator console
Articles

Webtools > Web design tools > Disable Hot-Linking of images and other files

Disable Hot-Linking of images and other files

A hot-linking is when some other site uses images hosted on yours. For example a.com has some pretty nice images. Then b.com decides that instead of hosting these images on their server, they can just link from their pages to the images hosted on site a.com.
Hot-linking usually is bandwidth and of course content stealing. The b.com site will not pay for the traffic used as the image is being loaded from site a.com.

So it is a good practice to prevent images hot-linking:

You can prevent the hot-linking of your images by creating a .htaccess file with the following content:

RewriteEngine onRewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://(www.)?your-domain.com/.*$ RewriteRule \.(gif|jpe?g|png)$ - The above code will result in a broken image to be displayed when it is hot-linked.

The example above works for .gif,.jpg and .png files, but you can add any file extension.

If you place the .htaccess file in the main folder of your site it will disable hotlinking for all your site.

To block other type of files, just add their extension to the list above. For example to block movie files:

RewriteRule \.(mov|avi|wmv|mpe?g)$ - The Hot-Linking prevention is based on an Apache module called ModRewrite. So your web host should support it in order for you to be able to use these on your site.

We will be discussing ModRewrite in a separate topic.


 

Tag : Disable Hot-Linking of images

 

WebTools Categories

Network Tools

Search engine tools

Web site tools

PHP resources

ASP tools and resources

Web design tools

JavaScript tutorials

CSS tutorials

Linux resources

Windows Resources

eCommerce Tools

Free Web Templates

MySql Resources

 

Popular Web Tools

MX lookup
WHOIS lookup
PTR Checker
IP Block Cheacker
IP to Location
Port Checker
Word Count
Character Count
XML sitemap creator
Age Calculator
Google Page rank
w3c validator