Forum Moderators: phranque

Message Too Old, No Replies

Redirecting to different domains according to ip

Redirecting to different domains according to ip

         

kees1964

10:37 am on Jun 25, 2012 (gmt 0)

10+ Year Member



Hi, I want to redirect all the my traffic on a certain domain to a different website (for example [redirect.com...] ). However, one ip-range I want to redirect to another website (for example disneyland.com)

This is what I have got so far:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) [redirect.com...] [L,R=301]

How do i make the exception that a certain ip-address (let's say 178.85.125.157) will be redirected to disneyland.com?

g1smd

10:57 am on Jun 25, 2012 (gmt 0)

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



Discussion from a few hours ago: [webmasterworld.com...]

Test for the IP and not the IP in the two rules. The ! is NOT. You'll need a redirect [R=301] in place of the rewrite used in that other thread.

Use example.com in this forum.