#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; my %hosts = ( "ftp.cgi101.com" => "http://www.cgi101.com/example/ftp/", "test.cgi101.com" => "http://www.cgi101.com/example/test/" ); my $host = $ENV{HTTP_HOST}; if (exists $hosts{$host}) { print redirect($hosts{$host}); } else { print redirect("http://www.cgi101.com/index.html"); }