homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum


 8:30 pm on Apr 12, 2013 (gmt 0)


I just appeared on page 1 for a certain keyword. One one of my competitors is now calling me on the phone and harassing me.

Is it possible to redirect JUST his IP address (of which I have) to another website (of my choosing) when he attempts to visit my website?

If so, can you help me out with the .htacccess code?

I have searched high and low in Google (mostly low) and the best query I could come up with to describe my problem was:

"how to 301 redirect a single ip address"

and the websites shown did not prove worthwhile.

So I have attempted to do my homework before coming on here and bothering you good people.

Thanks if you can help.



 8:32 pm on Apr 12, 2013 (gmt 0)

Edit: The best I could do is:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^121\.121\.11\.121
RewriteRule ^(.*)$ [my-domain.com...] [R=301,L]

But wasn't sure if that would work properly and not kill my SEO.

This is JUST to mess with the other guy. Nothing more.


 9:13 pm on Apr 12, 2013 (gmt 0)

Ouch! HTTP_HOST is your own domain name, not the other guy's IP address. You want REMOTE_ADDR :)

Does that other domain-- the one you're redirecting to-- have the exact same URL structure as your first domain? If not, there's no point to capturing anything in the request.


 4:50 am on Apr 13, 2013 (gmt 0)

Hi Lucy,

Yes, the other domain is www.website.com.

I just want to pass this trouble maker off to a "funny" website (that is not appropriate for me to post here).

Ok, so I'm completely lost here.....


 7:58 am on Apr 13, 2013 (gmt 0)

Er, not sure what the "Yes" is in reply to. I only asked one yes/no question, and its answer would appear to be No. :) Unless your "funny" site is a page-by-page parody of your real site, which seems a bit far-fetched.

Take a moment to read the post about using "example.com". It will save the moderators a bit of aggravation; they've got enough to do, weeding out the spam posts that tend to show up around this hour of the night.

Oh, and when I said

I meant: The "HTTP_HOST" condition looks at your own domain name. Any other value in this slot-- such as the other guy's IP address-- will always fail. If you want to test against his IP, use the "REMOTE_ADDR" condition.

Your original RewriteRule is syntactically correct, it's just using the wrong values in the wrong places ;)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved