Save 15% on Instant Deploy Bare-Metal Servers in 26 Global Markets with Coupon Code: EdgeSave

Prevent hotlinking

Others can link to images on your site to use them on their own web site, forums and elsewhere.
This is of no benefit to you and can increase the bandwidth usage for your hosting account quite a bit.

1. Activate Protection

To prevent people from hotlinking to your files (say image files), all you need t do is add the following lines to your .htaccess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg)$ – [F]

You can also protect files such as .mp3,.mpg,.ogg.The changes in this .htaccess file are on the last line. Enter the file extensions in the

brackets, do not include the dot (.). Separated them with a pipe (|).

You can friendly sites to link your images by adding a line such as
RewriteCond %{HTTP_REFERER} !^https://(www\.)?*$ [NC]

Share on Twitter
Share on Facebook