Home / Web Hosting / How to prevent hotlinking

How to prevent hotlinking

sneaky cat
Also known as inline linking, hotlinking occurs when someone else uses a picture or video from your site somewhere else on the web, but doesn’t bother to host the content themselves. These “free riders” can hog precious bandwidth and in some cases, cause server instability.

Fortunately, hotlinking is very easy to prevent. A number of web hosts and control panels provide opt-in hotlink protection to users, including cPanel. You can also stop hotlinking by adding the following code to your .htaccess file:

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

This code will block other websites from hotlinking your images. As you can see from the code, it is very easy to adjust the file types blocked.

Photo | Flickr

Check Also

servers

Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …

Powered by Namesco
© Copyright InternetBlog.Org.Uk 2024, All Rights Reserved