skype

LiveZilla Live Help

Login



Blog
Comments
Home : Blog : Htaccess : How To Prevent Others Hijacking Your Content (Images, Flash, Music Files)

How To Prevent Others Hijacking Your Content (Images, Flash, Music Files)

E-mail
User Rating: / 0
PoorBest 
Htaccess
Thursday, 21 June 2007 18:05

Well today we are going to learn how to deal against hotlinkers, that are using your content (images, flash, mp3s) instead of hosting them themselves. Below is the detailed explanation what to do in this case.

Even though somebody would think that if they use your pictures they are actually linking to your site so you will get benefits? Well that is not true. Hotlinking is not beneficial for search engine optimization. It can hurt your site SEO.

Some people are stupid enough to try to sue other websites for using their pictures. I say why bother. You can fix this tiny issue much quicker. We will try to get benefits out of hotlinking instead of suing those lazy webmasters J.

I see the hotlinking as a compliment, they obviously like your pictures, flash or music files and they are stealing it. At the same time they are using your bandwidth on your server and people can not see where the original location of that image really is. They could see it if the would look into the html code of the website.

Especially if the other websites are in the same niche category as your website is you can gain some benefits out of hotlinking.

So we are going to get some of their traffic and at the same time give them a polite alert that what they are doing is not polite.

Lets look at few examples for different media formats and hot to get traffic instead of gray hair and less bandwidth.

We are going to customize our .htaccess file that lies usually in the root of your server. Open it up with an html editor and add the following code

 

Images

Usually other webmasters are hotlinking images. So lets say hello to them first. There are many ideas what to do so you decide yourself. I think the best option os to create a customized image with a text “ For more info go to the site seoandwebdesign.com” were you replace your site instead of mine.

Name the image hotlink.jpg and upload it to your server where your site files are.

Then add this nifty code to your .htaccess file

 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ hotlink.jpg [R,NC]

 

You should put the url of your site instead of mydomain.com.

So my code would look like this

 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://seoandwebdesign.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://seoandwebdesign.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seoandwebdesign.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seoandwebdesign.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ hotlink.jpg [R,NC]

 

As you can see we took care of the both version of our site www version and non www version. You can also upload an ugly picture of a dog or some monster if you are feeling especially grateful for using your pictures

 

Flash Files

You have two options with flash files.

First option is to use the same method as for the images where you are replacing files with your customizable files that has your text, images and advertisement to your site.

Or you can choose a ninja style option where you can use getURL() method inside the flash file and the users will be forwarded to your site. So actually you are hijacking any hotlinkers site or dare I say Myspace page. Create flash file and name it hotlink.swf then put this in your .htaccess file.

Here is the htaccess code again for the flash files

 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
RewriteRule [^hotlink].(swf)$ http://www.mydomain.com/hotlink.swf [R,NC]

 

 

For my site it would loo like this

 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http:// seoandwebdesign.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http:// seoandwebdesign.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seoandwebdesign.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seoandwebdesign.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seoandwebdesign.com$ [NC]
RewriteRule [^hotlink].(swf)$ http://www. seoandwebdesign.com/hotlink.swf [R,NC]

 

Instead of my url put the url of your site.

 

Music files

It happens quite often that especially myspace users are hijacking the music files. So we will have some fun with that community. It should be fun to create a sound file of your speech where you advertise your site for example, or if you do not like advertising your site you could upload some Sanjaya “hits”.

Name your music file hotlink.mp3 then put this in your .htaccess file.

 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
RewriteRule [^hotlink].(mp3)$ http://www.mydomain.com/hotlink.mp3 [R,NC]

 

Comments
Add New Search RSS
+/-
Write comment
Name:
Email:
 
Title:
 
Please input the anti-spam code that you can read in the image.