HOME | ABOUT | CONTACT |

Search

Custom Search

Saturday, February 7, 2009

How to Fix Hotlink Protection Image Not Shown Problem?

Enabling hotlink protection is a good practice because it will prevent thieves directly linking to your images. Thus saving your bandwidth. After enabling hotlink protection from my server's cPanel, images were not shown anymore. What is the cause? And how to solve the problem? I searched the Internet but I did not find the solution for it. My problem is when I enabled the hotlink protection from my server's cPanel/HotLink Protection, it created all my websites' add-on addresses in "URLs to allow access" box. See below:

http://internet.airlineticketswithus.com
http://wp.airlineticketswithus.com
http://www.internet.airlineticketswithus.com
http://www.wp.airlineticketswithus.com

The above urls cause all images not being accessed correctly. In order to solve these problems I have to edit .htaccess file. (Warning: before you attempt to make any changes to this file. Make sure you save a copy of it in your PC.) Here is how I fixed the problem for my WordPress blog:
Options -Indexes

RewriteEngine on
# BEGIN WordPress

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


RewriteCond %{HTTP_REFERER} !^http://
learningwp.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://
learningwp.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.
learningwp.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.
learningwp.com$ [NC]
RewriteRule .*\.(jpgjpeggifpngbmp)$ - [F,NC]

# END WordPress
Make sure you change learningwp to be your own url.

Here is the fix for my Joomla website by editing the .htaccess file:
########## End - Rewrite rules to block out some common exploits
RewriteCond %{HTTP_REFERER} !^http://
internetoutput.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://
internetoutput.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.
internetoutput.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.
internetoutput.com$ [NC]
RewriteRule .*\.(jpgjpeggifpngbmp)$ - [F,NC]
Just add these codes to the end of your Joomla's .htaccess file. Make sure your change internetoutput to be your own url.

Now all my websites are hotlinks protected and all the images are shown to visitors. If you have any questions or advice, feel free to leave your comments here.

Related article
Why Do Images Disappear From My Joomla! Website?

3 comments:

5509989 said...

I am new and I am having same issue some how
all my images are getting eaten up. My site crashed once and the engineer re loaded it back from the back up on the server it ran fine for 15 days and all of sudden on my news section all the images disappeared. Next I have a recycle section with information and images with the http links they disappeared. My engineer wont help me I am stuck can some one please help me My E-Mail is KABA2@BELLSOUTH.NET. Thank you and God Bless

Lanna said...

Check the url of your images individually to see any images showing up on the browser. If not you might have to re-upload your images to restore them to each post.

Poster Girl said...

Ho do I do this with Blogger?

Post a Comment

Search

Custom Search