Welcome to WebmasterWorld Guest from 54.227.1.130

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect Specific Host to Specific Page

redirect ip address range to specific page

     

hurleygirl

5:53 pm on Jan 5, 2011 (gmt 0)



I'm trying to redirect a specific visitor when they visit my website.

I've been trying a variation of the redirect and can't seem to get it to work. Please tell me what's wrong?

RewriteEngine on
RewriteCond %{REMOTE_HOST} 65\.160
RewriteRule .* /go_away.html [R=301,L]

Your input is greatly appreciated.

ncsuEE98

6:47 pm on Jan 5, 2011 (gmt 0)



To prevent an infinite loop, you need to ignore the page where you are redirecting the user (go_away.html). I tested the following on one of our web servers:

RewriteEngine on
RewriteCond %{REMOTE_HOST} 65.160
RewriteCond %{REQUEST_URI} !(go_away.html)
RewriteRule ^(.*)$ /go_away.html [R=301,L]

hurleygirl

7:55 pm on Jan 5, 2011 (gmt 0)



stumped. it's not working on mine.

ncsuEE98

8:12 pm on Jan 5, 2011 (gmt 0)



What entries are you seeing being written to the logs for your request?

jdMorgan

10:50 pm on Jan 5, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Wrong variable being tested and redirect syntax not quite right... Also, optimize-out one rewritecond:

RewriteEngine on
#
# redirect visitors from 65.160.x.y to "go away" page.
RewriteCond %{REMOTE_ADDR} ^65\.160
RewriteRule !^go_away\.html$ http://www.example.com/go_away.html [R=301,L]

Note that this may be taken as goading by some, who may then desire to cause even more trouble for your site. So I'd suggest either making the "go away" page look like a 500_Server Error response, or returning a totally-blank page or a page with a bogus but real-looking error message on it to make it seem that your site is broken. If that's not desirable, then a 403-Forbidden response might be simpler.

RewriteEngine on
#
# respond to visitors from 65.160.x.y with a 403-Forbidden response
RewriteCond %{REMOTE_ADDR} ^65\.160
RewriteRule ^ - [F]

When dealing with troublemakers, it is best not to let it get personal -- either for you or for them. Also, you should *never* give a malicious visitor any information. Information is power, something not to be given to your enemies. Even indicating that "I caught you" is a foolish move, and may only make things worse. So I say 403 them and be done with it... No use worrying about them.

Jim

hurleygirl

1:45 pm on Jan 6, 2011 (gmt 0)



Thank you!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month