Image hotlinking is when other people display the image hosted in your web server on their own website. That is, they directly use the image from your website, instead of downloading it and uploading it on their own server.
This is not a problem if you have plenty of bandwidth, a dedicated server and you don’t care. 🙂 However, if you are in a paid shared hosting service where every KB of bandwidth, every memory and CPU usage count, allowing image hotlinking could give your web server additional load. Your bandwidth can be consumed faster. Memory and CPU usage could be higher than normal if someone hotlinked one of your images in a high-traffic site.
Because of this, I decided to disable hotlinking of images hosted on my blog. Images will only be displayed if it is used by macuha.com. Sites hotlinking to the images will see nothing.
Here’s the code I added on my .htaccess to accomplish this task:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?macuha.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ - [F,NC]
If you have cPanel. this could be accomplished easily. Here’s how. I don’t have cPanel so I have to directly edit the .htaccess file.
Oheay… thats one of the problem yung mga bloggers running there domain.. kasi medyu mahal nga yung bandwidth…But you shuld be happy if pag aabot kana ganun..kasi meaning okay na yung traffic mo unless yung mga asstes mo e anglalaki nila image/video… Before i do add bandwith 5gig/week.. sobrang maintenance… thats why i decide na kumuha nlng ng vps… ang now… no worry na ako i can set my bandwith unlimited….
sir, pa x-link naman o please
wow! nice tips, tamang-tama yan, naka shared hosting lng kc me. btw mmya n yung solar eclipse, hindi siya kita sa pinas kaya may live webcast link sakin.
@Jan Alvin – hehehe di ko nakita yung solar eclipse nakatulog ako.. hehehe
Nice tip. I just enabled it (after I read it here) in my cpanel. The only drawback here is pwedeng bumagal ang loading ng pages mo. Pero kung wala kang gaanong visitors gaya ko, wala kang masyadong mararamdaman. 😀
great tip! thanks! will do that on my sites.
@ jan alvin – palaging huli ako sa balita.. hahaha sayang. tsk.
Great advice man. Image hotlinking is really annoying, and this is how I stop it. More posts like this in the future please.!
That is really good info to have. I don’t have a problem with
hotlinking but my girlfriend does. Muchly appreciated.
Thanks for the heads up. Nothing more annoying that hotlinking. Arent those days over yet ? 😛
Anything wrong with this because I cannot make it work. I tried linking my other blog to my pics in my site and it is still showing up..
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?techathand.net(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ – [F,NC]
# END WordPress
@Dexter… try mo iclear ang browser cache mo when testing coz the image might still be in your browser cache kaya nadidisplay pa rin dun sa iba mong sites.
@Dexter:
try this:
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?jehzlau-concepts.com(/)?.*/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?jehzlau-concepts.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.jehzlau-concepts.com/ [R,NC]