Forum Moderators: phranque
Lynx: wget [localhost...] --referer=<URL>
Thanks!
#referer contians the phrase "junk"
SetEnvIfNoCase Referer junk keep_out
#referer begins with the phrase "junk"
SetEnvIfNoCase Referer ^junk keep_out
#referer ends with the phrase "junk"
SetEnvIfNoCase Referer junk$ keep_out
#referer comes from domain
SetEnvIf Referer ^http\://example\.com keep_out
Please note; in lieu of the term "keep_out or whatever term you use consistently.
You may also accomplish the same thing with mod_rewrite and/or multiple conditions.
Ex: Referer and comes from a specific IP range.
Ex: Referer and User Agent includes a specific phrase.
[pubcon.com...]
But I'm at a loss why both methods are failing...
But I'm at a loss why both methods are failing...
Again, what are your error logs reporting?
Are you sure it's failing?, the rewrite will not prevent the lines from appearing in your visitor logs, rather (in most instances) will provide a 403.
Or in the Jim's example you provided possibly a 302, 301 or even a 200 after completion (all depending upon your host).
My two hosts react entirely different to page replacements.
SetEnvIf and deny from, are the simpliest rules to comprehend and IMO, everybody should begin there and progress to more complex Rewrites.
Servers aren't magic; If the request gets through, then your filter string probably does not match the actual referrer. Oh, and do mind that perpetually-misspelled "HTTP Referer" referrer problem -- Not sure, but it might apply here...
Jim
# set the spam_ref variable
SetEnvIfNoCase Referer "^http://(www.)?some-spammer.com" spam_ref=1
SetEnvIfNoCase Referer "^http://(www.)?other-spammer.com" spam_ref=1
SetEnvIfNoCase Referer "^casino-poker" spam_ref=1
# block all referres that have spam_ref set
<FilesMatch "(.*)">
Order Allow,Deny
Allow from all
Deny from env=spam_ref
</FilesMatch>