August 20, 2014

9:30 am
In this article, we are going to discss about How to protect the image Hotlink using htaccess in Joomla. Currently there are 2 ways to protect your images from being used illegally by other website and to prevent bandwidth loss. One general way is to activate and use built in Hotlink Protection in your cPanel and the other way is by directly editing your .htaccess file.

Setting up .htaccess specific to Joomla is a little bit different from ordinary website. It depends on your server type and also your access to this file.

But for some reason, not all .htaccess setting work on any server such as those who hosted their website on litespeed server. For the purpose of adding the function of hotlink protection, you may need to add in these lines on the very top of your .htaccess file.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain\.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ [R,NC,L]

Why at the top?

To be true, I'm not in the position of really understanding the terms and explaining it to you. However, in Joomla 2.5 (as I know), you will need to put it on top of the list or else it won't work (It took me 2 days to figured it out...only after my web host provider informed me).

One thing that to note here - when you are using cPanel to manage your hotlink protection, it will automatically update your .htaccess file BUT the updated lines are usually added at the bottom of the .htaccess file. If that happened, you just need to relocate the lines.

For some reason, for those hosting on speedlite server, you'll need to extra lines:

RewriteEngine on
RewriteOptions Inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?exadomain\.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ [R,NC,L]

As I said before, just contact your hosting provider should you encountered problem pertaining your .htaccess file (only after you failed to follow general guide). After all, your payment for hosting inclusive of after sale services.


Post a comment