Knowledgebase
Webinova Online Customer Support > Webinova Help Desk > Knowledgebase

Search help:


How to block hotlinking to my Joomla image files?

Solution

Hotlinking is a way to take images or other files and embed them directly into a website that doesn’t own those files. In other words, it is an unauthorized use of someone else’s bandwidth. 

When hotlinking is detected and you need to serve some unexpected alternate content, add the following code to your .htaccess file. This will protect all files of the types included in the last line (add more types if needed):

# stop hotlinking and serve alternate content
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com/.*$ [NC]
RewriteRule .*.(gif|jpg)$ http://www.domain.com/donotsteal.jpg [R,NC,L]
</ifModule>

To deliver a standard (or custom, if configured) error page instead of some yucky, but funny image, replace the line containing the RewriteRule in the .htaccess directive with the following line:


# serve a standard 403 forbidden error page
RewriteRule .*.(gif|jpg)$ – [F,L]

To grant linking permission to a site other than yours, insert this code block after the line containing the domain.com string. Remember to replace goodsite.com with the actual site domain:

# allow linking from the following site
RewriteCond %{HTTP_REFERER} !^http://(www.)?goodsite.com/.*$ [NC]

 
Was this article helpful? yes / no
Article details
Article ID: 292
Category: General Joomla FAQ
Date added: 2012-12-11 15:31:49
Views: 19
Rating (Votes): Article rated 3.0/5.0 (6)

 
« Go back

 
Powered by Help Desk Software HESK - brought to you by Help Desk Software SysAid