Forum Moderators: phranque

Message Too Old, No Replies

.htaccess ban "Mozilla" string

.htaccess ban

         

vaggos

9:50 pm on Sep 12, 2007 (gmt 0)

10+ Year Member



Greetings,

I would like to find a way to block someone that is using an utility to crawl my website and is using "Mozilla" as refering browser, usually every visitor it displays like "Mozilla/5.0" for example I have never seen "Mozilla". Can I ban this string and do you think will be safe to block it?

Thank you

phranque

10:05 pm on Sep 12, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



not too many legit user agents are called exactly "Mozilla", so i think you are safe blocking it.
you could try this in your .htaccess file:

RewriteEngine on
#
# Block unwelcome user agent
RewriteCond %{HTTP_user_agent} ^Mozilla$
RewriteRule .* - [F]

vaggos

10:09 pm on Sep 12, 2007 (gmt 0)

10+ Year Member




It works it solved my problem.

Thank you very much for your help :)

phranque

10:12 pm on Sep 12, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



oh, and welcome to WebmasterWorld, vaggos!

g1smd

11:45 pm on Sep 12, 2007 (gmt 0)

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



Err. Many browsers use Mozilla in the UA string.

[mozilla.org...]

<edit>I see now that you mean *just* "Mozilla" and nothing else.</edit>

phranque

12:05 am on Sep 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



<edit>I see now that you mean *just* "Mozilla" and nothing else.</edit>

yes - that's why the UA string is anchored at both ends...

RewriteCond %{HTTP_user_agent} ^Mozilla$

g1smd

1:15 am on Sep 13, 2007 (gmt 0)

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



I read several hundred forum and blog threads per day, so just occasionally misread or misunderstand one.

No harm done.