Previously I wrote an article on Blogtechnika that How To Prevent Hotlinking Inside Your WordPress Blog. I got several response from readers. Thanks to Jaspal and Pascal who notified me about those images which are not displayed on Google feed reader.
I want to tell the reason behind this. The reason was that I prevent all the sites from hotlinking Blogtechnika’s image and unfortunately Google reader also don’t get permission to hotlink my image. That’s why images were not displayed in Google reader.
Also one of my reader Pascal asked an interesting question in the previous article:
I have two blogs. Example A & B. If my blog A has some images. It has been hot linked by B. If I did what you said here in my A blog , then Images won’t appear in B? Isn’t it? Is there any way give relaxation to my own blogs from this restriction?
Here I am telling a way from which you can stop hotlinking your WordPress blog but allow some sites to hotlink your images.
Paste the following code in .htaccess file and upload it to your root directory.
- RewriteEngine on
- RewriteCond %{HTTP_REFERER} !^$
- RewriteCond %{HTTP_REFERER} !^http(s)?://(www.yourdomain.com [NC]
- RewriteCond %{HTTP_REFERER} !^http(s)?://(www.yourdomain2.com [NC]
- RewriteRule \.(jpg|jpeg|png|gif)$ http://www.xxxxxx.com/images/nohotlink.gif [NC,R,L]
Line 3 & 4 are responsible for site allowed to link your images. You can add more site according to your choice.
You can overwrite the previous code with this code. Or you can make a new .htaccess file if you don’t have .htaccess file in a root folder.
This is the main problem for images to not displayed on Google feed reader. But now I added more site such as www.google.com/reader, www.facebook.com and few social media and news aggregator sites to allow hotlinking.
Note: Always allow your own websites for hotlinking. If you have two or more than two websites on the same server , add all the link of your websites in code so that your website may not affect by .htaccess method.
If you still met any problem, kindly discuss it in comment section. I will surely reply to your queries.
Update: Don’t add this line i.e. feed url of your blog (RewriteCond %{HTTP_REFERER} !^http://www.feeds.feedburner.com/blogtechnika [NC]) in place of links otherwise your blog will experience 500 internal server error. I don’t know the exact reason for this but it may be because of endless loop inside the server.
Subscribe to Blogtechnika for free updates. Follow me on Twitter @techim.
Related posts:
- How To Prevent Hotlinking Inside Your WordPress Blog
- Getting 500 Internal Server Problem While Opening Sites? May Be Problem in Your DNS [Tip of The day]
- How To Search For Flickr Images Quickly In Google Chrome
- How To Share Google Reader Feeds on Twitter, Facebook and Other Social Media Sites
- How To Restrict WordPress Admin Use By IP Address
{ 5 comments… read them below or add one }
This article closes all my questions and thanks for the quick update..
.-= Rajesh Kanuri´s last blog ..WordPress 2.9 Beta 2 is Available: Download & Explore =-.
Another Question : What about the Google Image search engine? Will it also work with it or we might lose our traffic from image search engine?
.-= Theme Premium´s last blog ..Drag to Share Wordpress Plugin Extended : Share Image With one Click =-.
Helpful Post! I had similar Problem before!
.-= Chethan´s last blog ..How to Get Traffic from Google Wave : Send Your Website via Wave =-.
Himansu, Thanks for the solution post. You are sharing your learnings continuously. It differentiates you from others. Keep up the good work.
.-= Pascal´s last blog ..Free Worpress.com to Self Hosted Wordpress.org Migration: =-.
I disabled hotlinking this way too last time but then there were just too many sites needed to be excluded on the list (and sometimes I wasn’t aware that I need to exclude such important sites)
.-= Michael Aulia @CravingTech´s last blog ..Wallpaper for the Ladies =-.