#**** SCRIPT STARTS **** # get the URL for the Web page that called this script $calling_page = $ENV{'HTTP_REFERER'}; # when the browser is Netscape, the referrer can contain the # and anchor name: REMOVE IT! (eg. http://hostname/file.htm#anchorname) if($calling_page =~ /(.*)\#.*/) { # only take the first part up to the # $calling_page = $1;} # ignore any file that is not _e.htm or _f.htm and do nothing! # is this an _e.htm file? if($calling_page =~ /_e\.htm/) { # replace the suffix $calling_page =~ s/_e\.htm/_f\.htm/; print "Location: $calling_page\n\n"; # then is this an _f.htm file? } elsif($calling_page =~ /_f\.htm/) { # replace the suffix $calling_page =~ s/_f\.htm/_e\.htm/; print "Location: $calling_page\n\n";} #**** SCRIPT ENDS ****