1 |
On 3 Mar 2006, at 02:24, A. Khattri wrote: |
2 |
> I have a web server with a virthost that has huge amounts of traffic |
3 |
> because everyone (and his grandmother) links to images in that site. |
4 |
> |
5 |
> I was wondering if there was a clever way to check the referrer |
6 |
> page and |
7 |
> deny requests for pages that are *not* on the site? |
8 |
|
9 |
What do you mean by clever? |
10 |
The "dumb" way is doing something like this (not tested) |
11 |
|
12 |
RewriteEngine On |
13 |
RewriteCond %{REQUEST_URI} !\.(html|php|other)$ # Allow |
14 |
requests for pages |
15 |
RewriteCond %{HTTP_REFERER} !^$ # Allow if |
16 |
referrer is blank (you might want to change this) |
17 |
RewriteCond %{HTTP_REFERER} !^allowedsite.com$ # Allow if |
18 |
referrer is known site |
19 |
RewriteRule (.*) - [F] # Deny other |
20 |
requests |
21 |
|
22 |
> Ive also installed mod_throttle too and would love to manage total |
23 |
> bandwidth per virthost (i.e. set a total of say, 5Gb per month, and |
24 |
> after |
25 |
> that deny requests). |
26 |
|
27 |
It's not perfect but I think this will do nearly what you want |
28 |
|
29 |
ThrottlePolicy Volume 5G 4W # Throttle based on volume of 5Gb over |
30 |
4 weeks. |
31 |
|
32 |
Yours, |
33 |
Craig |
34 |
-- |
35 |
Craig Webster | t: +44 (0)131 516 8595 | e: craig@××××××.net |
36 |
Xeriom.NET | f: +44 (0)131 661 0689 | w: http://xeriom.net |
37 |
|
38 |
"Te audire non possum. Musa sapientum fixa est in aure" - Unknown |
39 |
|
40 |
-- |
41 |
gentoo-server@g.o mailing list |