Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect /deny exception

deny referrer

         

renosteve49

4:10 pm on Nov 14, 2009 (gmt 0)

10+ Year Member



I've got a huge problem with a stalker to my website coming from ISP pacbell.net and aol.net I want to restrict access denying those. I know AOL is big, but it seems the only way. I am a novice to .htaccess coding, but could really use some help with code. What I want it to do is allow access to everyone else EXCEPT from pacbell.net and aol.com. Is there a mod rewrite for me with exceptions to the redirect? I want to redirect pacbell.net and aol.net to google.com.

Here's my current lame single line .htaccess code which redirects everyone at this time until I can get some code to work with:

Redirect 301 / [google.com...]

using their email address and tracer, I traced their source IP to San Francisco to an IP there at: 67.195.168.31

That user is using yahoo.com through host pacbell.net

Any help and I'd be forever grateful

wilderness

5:13 pm on Nov 14, 2009 (gmt 0)

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



Welcome to Webmaster World.

I want to redirect pacbell.net and aol.net to google.com.

Redirecting problem visitors to alternative websites and/or images is a bad practice. Simply denying access is more effective.

In rare instances and with AOL, you may focus upon both the IP Range and at least some portion of the User Agent. This possibility would somewhat reduce your AOL innocents.

using their email address and tracer, I traced their source IP to San Francisco to an IP there at: 67.195.168.31

This is a Yahoo IP not a PacBell IP.

In some email headers it may be quite difficult to locate the users primary IP, and in other instances, when you do locate the users primary IP range in an email header, the provider may use another range for non-email (i. e., website visits) activity.

Here's an example of a multiple condition deny [webmasterworld.com]

g1smd

6:23 pm on Nov 14, 2009 (gmt 0)

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



Another variation may be to temporarily feed every visitor with a cookie, each with a random number within. Keep a record of who gets each cookie, date and time, IP, browser, cookie number.

After the visitor has been back, look at the records to identify that user, then look up which cookie they were fed. Add rules to block access for that user based on the number they were given.

renosteve49

6:42 pm on Nov 14, 2009 (gmt 0)

10+ Year Member



OK, no referral to google. Could someone please give me the .htaccess code to ban Yahoo.net? An example would help.

wilderness

8:09 pm on Nov 14, 2009 (gmt 0)

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



I traced their source IP to San Francisco to an IP there at: 67.195.168.31

What makes you think this Yahoo Ip range has any relation to web access?
or even San Francisco?

Could someone please give me the .htaccess code to ban Yahoo.net?

Denying the Yahoo IP range will NOT deny your PacBell visitor.

Earlier today I provided the following example multiple condition deny [webmasterworld.com].

1) Remove the User Agent line.
2) Replace the 123.456.789 IP range with your visitors PacBell range.

renosteve49

8:14 pm on Nov 14, 2009 (gmt 0)

10+ Year Member



My referrer logs point the IP to the recurring visitor, and the IP matches the email IP. The user is on pacbell.net using Yahoo.com. His email address is a yahoo.com address, which is working. ISP in Frisco is either pacbell.net, yahoo.com or sbcglobal.net

wilderness

8:22 pm on Nov 14, 2009 (gmt 0)

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



My referrer logs point the IP to the recurring visitor, and the IP matches the email IP. The user is on pacbell.net using Yahoo.com. His email address is a yahoo.com address, which is working. ISP in Frisco is either pacbell.net, yahoo.com or sbcglobal.net

Which IP is it?
Yahoo, Pacbell or SBC?
Your website (s) refer and visitor logs ONLY provide a solitary IP, not three to choose from.

What appears to be happening is that the visitor is communicating with you via a Yahoo email and you are unaware of how to focus upon the "originating IP", rather than all the Yahoo IP's.

Additionally, if your running tracerts on incorrect IP ranges that you erroneously grabbed from email headers, your wasting your time with invalid attempts.

jdMorgan

12:56 am on Nov 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteEngine on
#
RewriteCond %{REMOTE_ADDR} =12.34.56.78
RewriteRule ^ - [F]

Put in whatever IP address you want to block, since that's not at all clear from the discussion so far.

Jim

wilderness

3:33 am on Nov 15, 2009 (gmt 0)

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



Jim,
What's the significance of the equals character?
TIA

Don

jdMorgan

2:17 pm on Nov 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Exact string (not regex) match, no escaping or anchoring required.

Jim

wilderness

3:10 pm on Nov 15, 2009 (gmt 0)

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



Many thanks Jim.

Is their any benefit (or difference) in using the equals character as opposed to using quotes?

Don

jdMorgan

3:25 pm on Nov 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not wanting to side-track this thread, but using "=" or "!=" makes it a literal string compare as opposed to a regex compare, and so is faster according to member Caterham.

Using quotes is usually unnecessary unless the given string to be compared contains unescaped spaces -- Doing so prevents mod_rewrite from throwing the "bad flags delimiter" error, since the mod_rewrite parser otherwise uses spaces to demarcate the "fields" in conditions and rules.

Jim