![]() |
|||
Preventing Hot LinkingHot linking, otherwise known as bandwith stealing, is a horrible crime in the webmaster's community. It occurs when someone links directly to images, css, or javascript files not on one own's server, thus enjoying those objects without having to pay for them, using up the money of the unlucky site owner instead.To help prevent this, you can use a .htaccess file, with Apache's module mod_rewrite enabled, to either 1)block or fail the request or 2)redirect the hotlinker, for example, to an angry message when hotlinking occurs. The code below will protect images, CSS (.css), and Javascript (.js) files on your site. Simply add it to your file and then upload it to either the root-directory or one sub-directory of your site.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC] RewriteRule \.(gif|jpg|js|css)$ - [F] Replace yourdomain.com with the domain of your site. This will generate a failed request when people try to hot link your files, thus showing a broken image.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC] RewriteRule \.(gif|jpg)$ http://www.mydomain.com/angrymessage.html [R,L] Again, replace yourdomain.com with the domain of your site. This code, instead of showing a broken image, will redirect the hot linker to angrymessage.html. And there you have blocked hot linkers! Congratulations! =) [Back] |
Custom Search
Home Gifts & awards Affiliates Link Exchanges Skins Contact Us Terms of Use Credits Div/Table IFrame/Popup Latest Additions Avatars Signatures PS Splash Pages Templates Lake Applets Scripts Entity Converter View All Photoshop Coding Yinyang Graphics ADP Halo Evolution Chibi Koneko G. Details Apply? [2] online 38.107.179.233 Valid HTML 4.01 Nature Elusidation The Road to Heaven Idyllic |
||
![]() |
|||