Protect from deeplinking

Aug18
  • Share/Bookmark

Difficulty: ★☆☆☆☆
A good example of deeplinking is that an other website is embedding your content (for example images or video’s) into his/her website.
Therefore this website does not need share own content. – The nasty thing is; that this will cost you bandwidth.
It loads content from your website, but without a site visit. Especially when full video’s are loaded, you don’t want this.

You can protect yourself from deeplinking.
In your .htaccess file add the following lines (notice the file extensions and your own domain):

Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?mydomain.com(/)?.*$ [NC]
RewriteRule .*\.(wmv|asx|jpg|gif|jpeg)$ http://localhost/ [R,NC] 

2 Responses to “Protect from deeplinking”

Beetje jammer dat bv Firefox geen referer meegeeft dus dan zijn je images niet te zien…..

maar10 on November 4th, 2009 at 9:37 PM

Hoi Maarten, zou je dit mij kunnen uitleggen? – Ik zie namelijk wel gewoon een referer in mijn httpheaders (en plaatjes). Of bedoel je na implementatie van bovenstaande htaccess rule?

Lee on November 4th, 2009 at 10:45 PM

Leave a comment