Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect script

Status
Not open for further replies.
Feb 1, 2005
144
0
0
US
Hi is it possible to redirect someone based on hostname, domain name sunet or ip?.

for example.

Users on dubnet 192.168.1.* attempts to go to however I want him to be redirected to
Thanks
 
I suppose you could use something like this:

Code:
if (substr($_SERVER['REMOTE_ADDR'],0,10)=='192.168.1.') {
    // redirect script
}

what's the application?
 
<?php



$host = getenv("REMOTE_ADDR");
list ($octet1, $octet2, $octet3, $octet4) = split ("\.", $host, 4);

// The next lines are the redirections based on octet values.
if ($octet3 == "132") { $Redirect= " }
else { $Redirect= " }

header ("Location: ".$Redirect)




?>
 
your code looks like it should work. what's the issue here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top