Administration Apache Security Tips and Tricks

Prevent hot linking of images.

Hot linking is displaying an image on a website by linking to the same image on another website, rather than saving a copy of it on the website on which the image will be shown.

Lets say, you have an image at www.yourdomain.com/image.jpg and it is not well protected. If someone links this image to his website as www.someoneelse.com/image.jpg, then it is going to consume both bandwidth and resources of your server when any end user access www.someoneelse.com/image.jpg.

All traffic of such requests will be coming to your server. It will be just like someone is enjoying a free ride and you are paying for it.

Hot linking of websites can be prevented with following simple .htaccess rule placed in the DocumenRoot folder of your website.

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

Please remember to replace “yourdomain.com” with your own domain in the above .htaccess.

Related Articles

  • Purging and Loading assets onto your CDN

    Step 1: Login to the Webair EZPanel (https://ezpanel.webair.com) Step 2: On the left side menu, click on CDN.   Step 3: Click on the “Webair CDN” button. This will open up...
  • Whitelist FTP IP

    Webair blocks all FTP access on[label color=”primary”] Managed Dedicated, VPS, and Cloud servers[/label]. This is for secure FTP access to prevent unauthorized access and hacking attempts. If you need FTP...
  • How to Display MySQL Storage Engines

    How to Display MySQL Storage Engines From the MySQL command line, issue the following command: SHOW ENGINES; You should receive a result similar to:   Typically the default storage engine...
  • Checking Hacked Server

    Categories of server:   1.1 Webair managed client server: Webair will perform a variety of custom configuration, maintenance, and optimization your server for maximum performance and reliability. A list of...