Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
4 registered (alissarose, KuKuKaChu, Dunny, id242), 40 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 06/05/06
Posts: 469
Top Posters (30 Days)
Ruben 51
Gizmo 24
DennyP 24
Dunny 15
SteveS 14
AllenAyres 12
SD 10
dbremer 10
drkknght00 9
doug 8
Latest Photos
OK Corral Shoot Out
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Topic Options
#189672 - 07/02/07 01:36 AM How do I stop leachers from linking my content?
Gizmo Offline

Registered: 06/05/06
Posts: 14995
Loc: Portland, OR; USA
One quick and easy trick in Apache to block users from leaching your images (or other files) from your web space is with mod_rewrite; the rule I'm going to share with you today will block image leachers and file leachers from raiding your bandwidth.

Each site you wish to add will have its own line, and will be prefixed by "RewriteCond %{HTTP_REFERER} !"

Blocking Image Hotlinkers .htaccess entry:
 Code:
# Start UGN Specific Hosts #
RewriteCond %{HTTP_REFERER} !38.99.95.240 [NC]
RewriteCond %{HTTP_REFERER} !38.99.95.222 [NC]
RewriteCond %{HTTP_REFERER} !undergroundnews.com [NC]
RewriteCond %{HTTP_REFERER} !undergroundnews.net [NC]
RewriteCond %{HTTP_REFERER} !undergroundnews.org [NC]

# Start Affiliate Hosts #
RewriteCond %{HTTP_REFERER} !ubbdev.com [NC]
RewriteCond %{HTTP_REFERER} !ubbcentral.com [NC]

# Start Search Engine Hosts #
RewriteCond %{HTTP_REFERER} !google.com [NC]
RewriteCond %{HTTP_REFERER} !yahoo.com [NC]
RewriteCond %{HTTP_REFERER} !picsearch.com [NC]
RewriteCond %{HTTP_REFERER} !^http://aolsearch.aol.com [NC]

# Start defined files & redirect location #
RewriteRule [^/]+.(jpeg|jpg|gif|bmp|png|JPEG|JPG|GIF|BMP|PNG)$ - [F]


This will block all users linking to the file types ".gif", ".jpg", ".jpeg", ".psd", ".png"; they will receive a red X when trying to link to your graphics.

You can forward them to another graphic of your choosing as well by replacing the image rule at the bottom of the above example with:
 Code:
RewriteRule [^/]+.(jpeg|jpg|gif|bmp|png|JPEG|JPG|GIF|BMP|PNG)$ http://www.yoursite.tld/nofreelinking.gif [F]


You can use the above rules to also block hotlinking to files by using:
 Code:
RewriteRule [^/]+.(exe|com|swf|fla|mp3|mov|wmv|rm|ram|wma|zip|txt|bat|tar|rar|gz|tgz)$ - [F]


And you can additionally use it to block BOTH files and graphics with:
 Code:
RewriteRule [^/]+.(exe|com|swf|fla|mp3|mov|wmv|rm|ram|wma|zip|txt|bat|tar|rar|gz|tgz|gif|jpg|jpeg|psd|png)$ - [F]


The hosts section has separate sections for your site hosts (for sites with more than one domain), affiliate hosts (so you can allow your affiliates to grab your content), and for search engines (so Google images can grab copies of your files to show in an image search).
_________________________
Forums: UGN Security & VNC Web Design & Development
UBB.Threads: UBB.Wiki, My UBBSkins, UBB.Sitemaps
Longtime UBB Supporter, UBB Beta Tester & Resident Post-A-Holic.
UBB Modifications, Styling, Coding Services, Disaster Recovery, and more!
Top
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."



Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Temporary Password email not being received
by
05/24/12 10:02 PM
Ability to "like" individual posts (not Facebook "likes)
by doug
05/23/12 09:03 AM
Island Permissions
by ThreadsUser
05/22/12 03:03 PM
streaming video
by prkrgrp
05/20/12 07:02 PM
New Posts Corrupted? Can someone help?
by PianoWorld
05/19/12 09:41 AM
Forum Stats
10490 Members
36 Forums
33841 Topics
181708 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image