How to Prevent Image Hotlinking through .htaccess

What is Hotlinking

Hotlinking is the process of displaying an image on a website by linking to the same image on another website. It is mostly occurs with images. In simple words suppose i want to show some gadget picture on my website so instead of uploading the picture on my website, i link this picture to someone website using source as

Why Someone Hotlink Your Website Images

To save their server cost/bandwidth. The other reason might be they are very lazy to upload the image on their own server. If you don’t prevent hotlink then definitely it increases load on your web server. To prevent hotlinking you need to define htaccess directives.

Subscribe Our Tutorials

Get Latest Updates on Facebook

How to Prevent Hotlinking Through .htaccess

If you don’t know about .htaccess. Read my previous post on htaccess tutorial , Deny access of files and folders through .htaccess and How to leverage browser caching.

1. It prevents all the domain from hotlinking except

2. Prevent from hotlinking

3. Display images steal warning. In this case if someone try to hotlink it shows the warning image.

These htaccess directives solve hotlinking problem.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , , . Bookmark the permalink.