Forum Moderators: phranque
I have recently used htaccess to protect hotlinking of images from my site as bandwidth overage was cutting deep into my pocket. I have used a small gif file to replace the hotlinked image. After a few tweaks here and there it did work, but when I try to look at the images at my own site that have been hotlinked, the replacement image is being shown until I refresh the page. Once I refresh the page it goes and the original image is shown again.
I don't know why this is happening and the only option left for me is to stop the hotlinking protection which means I have to pay a huge load on bandwidth overage and eventually close down my site.
Can someone please help? Also, in case it is already there on the forum and I missed, please direct me to the thread.
This is just an annoyance to you, it does not mean that your anti-hotlinking code isn't working.
Your best bet if you want to avoid this issue completely is to forget about serving an alternate image, and simply respond with a 403-Forbidden response, taking care that your custom 403 error page (if any) is very small and is marked as non-cacheable.
I make my custom 403 error page very small by leaving out all unnecessary headers, styling and formatting, and providing only the simple message "Access Denied - click here [WebmasterWorld.com] for more info." The link goes to a 'friendlier' page which explains the error and provides links to the home page and other 'help' pages.
Jim