Forum Moderators: bakedjake
- I know that his hostname will always be name.corp.whatever.com. Not sure if this will always redirect to the same IP.
- I only need to do the redirect for this one IP.
- I do not have access to Apache server configuration or .htaccess files. Would like a way to just do this in Perl CGI if possible.
Thanks,
noob999
use Socket;
$ipaddr = inet_aton($ENV{'REMOTE_ADDR'});
$host = gethostbyaddr($ipaddr, AF_INET);
if ($host = 'badguy.whatever.com') {
print "Location: http://example.com\n\n";
}
Otherwise you can just pull the hostname directly from $ENV{'REMOTE_HOST'}