Forum Moderators: phranque

Message Too Old, No Replies

Check my htaccess code please

How to block spamming sites

         

Kode_Kid

3:44 pm on Nov 10, 2003 (gmt 0)

10+ Year Member



Hi all,

Can somebody look over my htaccess code to see if it should be doing what i want it to do?

I have a site (qn-213-xx-197-30.examplenet.nl) and a user agent (badapp 1.1 (www.example.com)) sucking the bandwidth off one of my sites.

I wrote the following htaccess file to block both from future access. Will this work?:

SetEnvIfNoCase User-Agent "^badapp" bad_bot

Order Allow,Deny
Allow from All
Deny from examplenet.nl
Deny from env=bad_bot

Kid

[edited by: jdMorgan at 3:51 pm (utc) on Nov. 10, 2003]
[edit reason] No real IPs or hostnames, please. [/edit]

jdMorgan

3:58 pm on Nov 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Kode_Kid,

Welcome to WebmasterWorld [webmasterworld.com]!

You code looks fine. However, it would be much more efficient to block examplenet.nl by IP address, rather than by remote-host. Using an IP range would eliminate an additonal reverse-DNS lookup on every request to your server. Reverse DNS lookups are slow, so avoid using remote-host whenever possible.

You can easily test your code by substituting your own hostname or IP address in the code, and by changing your user-agent by editing it or by using a user-agent spoofing tool.

Jim

Kode_Kid

4:15 pm on Nov 10, 2003 (gmt 0)

10+ Year Member



... it would be much more efficient to block examplenet.nl by IP address ...

Where would i look up the IP address for a server in the netherlands? I tried using some whois sites but they all come up blank and refer me to a whois site in the netherlands that does nothing more than confirm the site exists.

Also, if their IP covers a range of IPs, how do i cover that range in my htaccess? I used to know this, but it's been a long time since i've delved into this htaccess stuff.

Any help would be greatly appreciated.

:)

jdMorgan

4:25 pm on Nov 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One way to cover IP ranges: [webmasterworld.com...]

Please take a look through the previous posts here in this forum - there are many more examples to be found.

The IP address is already there in your log entry - it's just obscured using dashes instead of dots. You can look it up at [ripe.net...]

Jim

Kode_Kid

4:45 pm on Nov 10, 2003 (gmt 0)

10+ Year Member



Thanks JD, i appreciate your time. I didn't know that was the IP address in the log entry.

I'm learnin' ....... :)