Website Design News
Simpleviewer Image Gallery "White Crosses" - Hotlink Protection
Problem: Simpleviewer gallery on a Joomla! site displaying white crosses instead of gallery images- Turn off Hotlink Protection (Not recommended)
- Enable Hotlink Protection but tick the box which says "Allow direct requests (ie. entering the url to an image in your browser)"
- Consider using .htaccess to protect your image folders - I am currently investigating this however the code goes something like this (I have put the differences in bold for the first four lines purely to identify why they are there - note that if you want them accessed from more than one location you need to put extra SetEnvIfNoCase lines for each URL. Likewise if you want more than .gif, .png and .jpg you need to specify these).
SetEnvIfNoCase Referer "^http://www.your-domain-name-here.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://www.your-domain-name-here.com$" locally_linked=1
SetEnvIfNoCase Referer "^http://your-domain-name-here.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://your-domain-name-here.com$" locally_linked=1
SetEnvIfNoCase Referer "^$" locally_linked=1
<FilesMatch "\.(gif|png|jpe?g)$">
Order Allow,Deny
Allow from env=locally_linked
</FilesMatch>
Whenever a browser sends your web server a request for an image, it usually also sends the URL of the page that linked to that image.
The above .htaccess file causes the server to check this URL ("Referer" in the above snippet - DO NOT CHANGE THE SPELLING) and if it is one of the authorized URLs that you specify, it will set an internal flag called "locally_linked". This internal flag is technically called an "environmental variable".
If the URL sent is not in this list of authorised URLs, the flag (or environment variable) is not set. Note that we also set the "locally_linked" variable if the browser does not send any URL at all: this occurs when the visitor accesses your site using a browser or a proxy that suppresses the referring URL.
The web server then checks if the file requested has an extension in the list given above (gif, png, jpg and jpeg). If so, and the "locally_linked" variable is set, it will send the image. Otherwise it an error will be sent.

