Prevent image hotlinking for Joomla using FTP

Updated on Mar 13, 2019

Hotlinking, also called inline linking, involves displaying an image on a website by directly linking to that image from another website. For example, you may have a number of images on your website. Someone, somewhere, may feel that they would like to use the same images on their own website, but instead of saving their own copies on their website, they may insert the images via direct links to yours. This way, they will be using your bandwidth for the images and this will cost you money.

This is sometimes a common practice, even though there are organizations that track such issues and report them to the site owners. However, it exists an easy way to prevent such practice and we will guide you through the process of hotlink-protecting your Joomla website.

To prevent hotlinking, you will need to follow these steps:


Locate the Joomla installation

Start by locating your website on the server. If you access your website via the following link:

where is the actual domain that you are using on your website, it means that Joomla installation is located directly within the public_html/ directory of your account. Instead, if you access your website via the following link:

where is your domain name and “joomla30” is a subfolder on your account, it means that Joomla installation is located in a folder, called “joomla30” within the public_html/ directory of your account.


Create an Image

Now Create an image which will be displayed each time, when there is a hotlinking to content on your website. If you have some development knowledge you can create an entire page, or configure your website in multiple ways to prevent hotlinking.

Our experience shows that with the use of one image, it is easier and faster to configure the hotlinking protection on your Joomla installation. It is important to save your image with an .jpe extension. In our example, we are using hotlink-protection.jpe

When you create the hotlink-protection.jpe image, you have to upload it to the correct location of your website via FTP.

Working with FTP

To learn more on how to install a FTP client and access your hosting account via FTP, please visit our step by step FTP tutorials.

As you have already located the Joomla installation on your account in the first step of this tutorial, what you need to do is to simply navigate to the images/ directory in it and upload the hotlink-protection.jpe file there.


After you locate the directory of your Joomla website, you need to go the .htaccess file and download it on your personal computer. From there, you can edit it with a simple text editor, such as Notepad/ Notepad++. It's recommended to avoid rich-text editors, such as Microsoft Word.

When you open the .htaccess file of your Joomla website for editing, you need to enter the following lines of code:

     RewriteEngine On
     RewriteCond %{HTTP_REFERER} !^http://(.+\.)?example\.com/ [NC]
     RewriteCond %{HTTP_REFERER} !^$
     RewriteCond .*\.(jpe?g|gif|bmp|png)$ /images/hotlink-protection.jpe [L]

Where is your actual domain name and you need to change that accordingly.

What this rule does is to allow the use of the images on your website, however, all requests from other websites for the specified extension types will be redirected to the hotlink-protection.jpe image that you have created in Step 2.

On this page...

    Joomla Hosting

    • Free Installation
    • 24/7 Joomla Support
    • Hack-free Protection
    • Fast SSD Storage
    • Free Domain Transfer
    • Free Joomla Transfer
    • Free Cloudflare CDN
    View More