Possible Duplicate:
How to prevent hot linking (“image theft” / “bandwidth theft”) of ressources on my site?

I'd like to configure my Apache server similar to a working configuration I noticed on the Farming Simulator website. They use CSS background images for their main navigation bar but if you try to view an image with a direct link (example) it returns a 403 Forbidden error. I know how to allow/deny indexes for directories, but not how to deny access to files within those directories.

Does anyone know how I'd go about configuring .htaccess to work like this?

I found a similar question but it doesn't really answer mine.

marked as duplicate by Michael Hampton, voretaq7 Nov 11 '12 at 1:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


First I want to tell you that this is a very futile act. As soon as you see the image in your browser, it has been downloaded to your computer.

When I followed your link directly I had a 403. Then I visited the page and I could even see the image in the link because it was in the cache.

I believe this effect is produced by examining the referer of the request. A sample for blocking by referer can be found here

I still recomend you not to do it. Not many people try to hotlink a background image. And if they really want to, it's still easy to overcome this measure by simply changing the header.

Not the answer you're looking for? Browse other questions tagged or ask your own question.