Forum Moderators: phranque

Message Too Old, No Replies

SetEnvIf Referrer syntax

         

keyplyr

6:19 pm on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Not quite sure I've set this up corrrectly or not. Is this the simplest way to ban a mix of URLs and IPs? Thanks

SetEnvIf Referer "home-3\.worldonline\.nl/~omeremo" ban
SetEnvIf Referer "pianotabs\.net" ban
SetEnvIf Remote_Addr ^210\.186\.40\.246$ ban
SetEnvIf Remote_Addr ^68\.89\.65\.49$ ban
SetEnvIf Remote_Addr ^202\.155\.20\.131$ ban
SetEnvIf Remote_Addr ^67\.83\.117\.19$ ban
<Files *>
order deny,allow
deny from env=ban
</Files>

Key_Master

6:32 pm on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks fine to me. One small note, with the SetEnvIf directive, you only need quotations when the variable contains a space.

keyplyr

7:00 pm on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Key_Master,

Actually, I had it without the double quotes until I read jdMorgan's comments:


...I'd recommend surrounding all user-agent strings which contain spaces or any other special characters, such as colon, slash, period, etc. with double quotes. A space or any other character that has special meaning to setenvif will cause a 500 error if the string's not delimited by quotes.

[webmasterworld.com...] msg #:3

Since the top referrer contained a tilde, I didn't really know if escaping the dots was enough, so I added the double quotes. But if they are not needed in this case, I'll remove them. Thanks again.