Proventing Image Hotlink for Wordpress-supported Blogs
Posted Aug 30, 2008 by Lindsay Britney
Needless to say why to block the image hotlink from a site, simply because of the need to prevent someone to steal its bandwidth (thus save the extra money for the webhosting).
Wordpress gurus please ignore this entry, as the post here is only intended for those newbies who just host their wordpress.org-supported blogs on a web host and want prevent other bloggers hotlinking their images.
Follow the steps below and make your images only available to your own site and let search engines, like Google, Yahoo and Msn, to index.
- Log in your FTP client, here we recommend to use FileZilla (it’s open source, and versatile)
- Locate “Server” menu, and click “Force showing hidden files”
- Doube-click the the site root directory in the FileZilla panel, like this site, it’s hollywoodcelebgossips.com.
- Find a file named .htaccess
- Download it to the desktop and open it using Notepad, you are now getting the default Wordpress .htaccess file.
- Insert the code in Step 7 below the line of “
RewriteRule . /index.php [L]"obtained from the default file in this step. -
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpe?g$|.*gif$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !hollywoodcelebgossips\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !live\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !msn\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule .* - [F]
- Say if your URL is www.example.info, replace “hollywoodcelebgossips” and “com”, with “example” and “info”, respectively, in the fourth line of the code above.
- Save .htaccess file in Notepad and upload it to your site root directory in FileZilla panel.
- When prompted if to overwrite the existing file with the same name, click “Yes” in the pop-up window.
- You make it! The images will only appear on your own site, RSS readers and some time later search engines’ image search will bring you the traffics.
If wanna know how to tweak .htaccess file for non-wordpress supported blogs/sites, please visit WalkerNews.net’s Image Hotlinking Prevention With Apache Mod_Rewrite which is also the inspiration of writing up this tip.
#Permalink Tags: Code, Hotlink prevention, Howto, htaccess, Image Hotlink, Wordpress
September 11, 2008 at 8:34 am
Update: some may find this post due to Google’s Image Search
October 15, 2008 at 10:10 pm
Bloggers need images but many of them don’t how to do image job properly. So they hotlink without permission.
To address this issue we build a website acobox.com that allows users to hotlink images that it hosts. So, in addition to ban people from hotlinking from our sites, we may tell them: go acobox.com if you need free, hosted images – hotlink acobox as much as you like but don’t touch my site
October 16, 2008 at 7:48 am
Hi, bob,
I checked your site and found parts of your Hotlink License states:
As most of your pics are easily found via Wikipedia Commons search, I think, a lot of bloggers may download the pictures they desired and directly link to the original source with due credits included in their posts. So how do you think they will only hotlink to your page?