How To Allow Image Hotlinking In Specific Directories With .htaccess

Earlier today I shared an article about how to image hotlinking in your website with .htaccess file. I also applied this trick on my own website’s .htaccess file, but I faced a huge problem. I also run a Google PageRank checker tool, which allows you to check your PageRank & also add the PageRank badge to your website.

Just after adding the hotlink snippet to my .htaccess file, all the PageRank badges were also locked from appearing on other domains and it was a huge problem for me. So I found a way to allow image hotlinking in a specific directory.

Simply add the following line to your target directory’s .htaccess file and enjoy immediate results:

The above snippet should be placed on the directory’s .htaccess file, not the .htaccess file of the root.