# First location with www in it my $_tdomain = $ENV{SERVER_NAME}; my @_tdom = split(/\./, $_tdomain); if(length($_tdom[2]) > 1 && $_tdom[0] ne "www") { $_username = $_tdom[0]; $_username = $dbh->selectrow_array(qq{select `username` from `reg_members` where `subName` = ? and `subNameStatus` = "1"}, undef, $_username); if($_username && $ENV{SCRIPT_URL} eq '/') { window_redirect("http://www.domain.net/index.cgi?page=home&username=$_username&rdf=sub$sess_id"); } }