LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-11-2008, 08:53 PM   #1
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Rep: Reputation: 45
Configuring apache to disable bandwidth stealing


Hi

In the last month my server uploaded over 10G of images via websites that include images from my server. I'd like to stop that

I'm running apache2 on Slackware 12. I have mod_rewrite enabled.

I've tried following http://www.besthostratings.com/artic...t-linking.html but it doesn't work so well.

Here are the contents of my htdocs/misc/testimageblock/.htaccess:

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER}  !^-$
RewriteCond %{HTTP_REFERER}  !^http://(www.)?littlesvr.ca.*$ [NC]
RewriteRule \.(gif|jpg|png)$ http://littlesvr.ca/misc/not-hosted-here.png [F]
I can get to it via:

http://littlesvr.ca/misc/testimagebl...spose-none.png

but not via:
http://www.littlesvr.ca/misc/testima...spose-none.png (this is not what i want)
http://cdot.senecac.on.ca/projects/toaster/2.html (this is not exactly what i want, the replacement image isn't shown)

And I keep seing 200 responses for images from http://www.fretsonfire...wherever

So I guess it doesn't work

Help, anyone?
 
Old 11-12-2008, 02:32 PM   #2
teknik
Member
 
Registered: Jun 2006
Location: Winnipeg, Canada
Distribution: Slackware 12.1
Posts: 33

Rep: Reputation: 16
well for starters you'll want to take the [F] out of there. That will just cause a 403 to be returned, instead of your false image. Also I'm not sure about the "-" in your first RewriteCond, but then again I'm not overly experienced with this...

Anyway, try this:

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER}  !^$
RewriteCond %{HTTP_REFERER}  !^http://(www.)?littlesvr.ca/(.*)$ [NC]
RewriteRule \.(gif|jpg|png)$ http://littlesvr.ca/misc/not-hosted-here.png [T=image/png]
 
Old 11-12-2008, 08:00 PM   #3
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Original Poster
Rep: Reputation: 45
Yay, it works now! Thanks a lot teknik!

Final version:

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER}  !^$
RewriteCond %{HTTP_REFERER}  !^http://(www.)?littlesvr.ca/(.*)$ [NC]
RewriteRule \.(gif|jpg|png)$ http://littlesvr.ca/misc/not-hosted-here.png
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache bandwidth limiting? Jukas Linux - Software 1 11-29-2006 07:02 AM
Apache Bandwidth Limit kirtimaan_bkn Linux - Networking 0 07-26-2006 07:18 AM
The Cloudy issue of stealing bandwidth jaz General 11 08-14-2005 12:55 AM
Apache Limit Bandwidth Boffy Linux - Networking 2 01-02-2005 05:54 AM
apache Bandwidth Limit genexis Linux - General 0 02-18-2004 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration