Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
7 registered (SteveS, mcasado, Mike L, Gizmo, SD, Bjab, driv), 18 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 06/05/06
Posts: 255
Top Posters (30 Days)
Ruben 63
SD 54
Gizmo 48
gliderdad 33
Dunny 21
driv 18
dbremer 16
Iann128 16
Stan 14
Mark S 13
Latest Photos
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Gizzo Marx
Topic Options
#189672 - 07/02/07 01:36 AM How do I stop leachers from linking my content?
Gizmo Online   cat

Registered: 06/05/06
Posts: 14904
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
Edit Post
by Bert
01:19 PM
A positive note
by SteveS
09:36 PM
How to locate links to particular site if they are only used in images?
by Conrad
02/10/12 09:41 PM
Pictures not displaying
by Marker23
02/09/12 10:04 PM
Issue with logging out constantly
by Flanuva
02/09/12 07:05 PM
Forum Stats
10213 Members
36 Forums
33667 Topics
180917 Posts

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